| PLEX86 | ||
|
CLI: Using LocateCLI= Command Line Interface Bash you get a list of the paths to files that you have to type or cut&paste onto the commandline. Here's a simple script using Bash's select command that makes things much nicer: #!-bin-bash #name of script(file) is loc.sh # Ctrl-c to exit select word in $(locate "$1") do cd $(dirname "$word") less "$word" done ----------- As root, move the file tousr-local-bin (or some other directory on your PATH echo $PATH) and make it executable with: chmod +rx loc.sh Now, put this in your ~-.bashrc: alias loc='source loc.sh' and do: source ~-.bashrc Now, when you enter, for example: $ loc java at the prompt, you'll get something like this: $ loc java 1)doc-2.4.19-Documentation-java.txt 2)doc-HOWTO-Apache-Compile-HOWTO-ssjava.html 3)doc-HOWTO-JavaStation-HOWTO-javastationboot-bootyourjavastationchapter.html 4)doc-HOWTO-Secure-Programs-HOWTO-java.html 5)doc-HOWTO-XML-RPC-HOWTO-xmlrpc-howto-java.html 6)doc-usr-share-doc-kernel-doc-2.2.20-Documentation-java.txt.gz 7)usr-lib-mc-syntax-java.syntax 8)usr-share-a2ps-sheets-java.ssh r r 9)usr-share-automake-java-clean.am 10)usr-share-automake-java.am #? Enter 1, anddoc-2.4.19-Documentation-java.txt will open in less. When you exist less, you'll see the same list. Exit the script with Ctrl-c and you'll be indoc-2.4.19-Documentation-. If the file won't display in less (like device files indev), $ loc xda 1)dev-xda 3)dev-xda2 5)dev-xda4 7)dev-xda6 9)dev-xda8 2)dev-xda1 4)dev-xda3 6)dev-xda5 8)dev-xda7 #? $ 1 less will exit with an error message: dev-xda is not a regular file (use -f to see it) Unable to do backups in cronjob I'm having no end of problems getting backups to work from cron. I currently have a script which works when invoked directly, but fails... and you'll be indev-. If the list is too long to display on a single screen, scroll buffer with Shift-UpArrow (on most boxes), and when you see the right entry, enter its number then. Hope some of you find this as useful as I do, AC --
|
||||
Unable to do backups in cronjob Linux groups from Newsgroups The #1 Usenet Provider on the Internet
Friend is interested to learn Linux Sys admin, will it help for his Career 4671 |
||||