Post a Comment
This is good stuff, but there are some issues. The version of rename on my system (Mandriva 2007) doesn't seem to take a regular expression. The man file documents it's arguments like this:
rename from to file...
Also this won't work:
alias mv=mv -i
You need to use quotes:
alias mv='mv -i'
Remember, the meaning of GNU...
Actually, there have been variants in shell processing in Unix and Linux systems for years. How many shells are there in a standard Linux Distro? Each of these have little quirks of their own. Some handle spaces in directory names better than others. etc etc etc.
I have used the construct you have used in your example in Unix for example
mydir=`pwd`
Overall, these little differences are small and IMHO pretty insignificant.
I have a subset of shell commands which work pretty well on virtually any shell in Unix or Linux (apart from older AIX versions...) which enables me to write pretty portable scripts without too much trepidation.
Any clearly written text on shell programming is very worthwhile IMHO.
I think he wanted to set the variable mydir to the output of the pwd command, which is what that statement does as written. However, a better way to write this kind of operation (in any Bourne-like shell) is:
mydir=$(pwd)
This is the preferred syntax for assigning the output of a shell command to a variable. One of the reasons is that backticks cause confusion. Or, in this particular case, this would be more efficient:
mydir=$PWD
$PWD is an environment variable available in every UNIX-like shell I've ever encountered.
check my site for other CLI related tasks:
http://toya.net.pl/~vermaden/links.htm



