Linked by Eugenia Loli on Thu 8th Feb 2007 21:16 UTC
General Unix UNIX has a dialect all its own and you will find with the UNIX command-line, there are many ways to skin a cat. Martin Streicher, Editor-in-Chief, Linux Magazine, shares his extensive knowledge and experience with command-line combinations to help you expand your mastery of the UNIX language and in the command-line in particular.
Order by: Score:
by KenJackson on Thu 8th Feb 2007 21:43 UTC
Member since:

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'

Reply Score: 2

RE: Details
by shotsman on Thu 8th Feb 2007 22:16 UTC in reply to "Details"
shotsman Member since:

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

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.

Reply Score: 1

RE[2]: Details
by archiesteel on Fri 9th Feb 2007 00:15 UTC in reply to "RE: Details"
archiesteel Member since:


Careful, you have backquotes instead of apostrophes there...wouldn't that simply assign the value of the current directory to mydir, instead of the actualy pwd command?

Reply Score: 3

RE[3]: Details
by butters on Fri 9th Feb 2007 01:09 UTC in reply to "RE[2]: Details"
butters Member since:

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:


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:


$PWD is an environment variable available in every UNIX-like shell I've ever encountered.

Reply Score: 3

RE[4]: Details
by archiesteel on Fri 9th Feb 2007 01:21 UTC in reply to "RE[3]: Details"
archiesteel Member since:

Yes, you're absolutely right, hence the choice of the name "mydir" for the variable. (Doh!)

I'm sorry, it's been a long day!

Reply Score: 2

Good one
by Sphinx on Fri 9th Feb 2007 06:21 UTC
Member since:

Use of perl instead of sed or tr, very nice.

Reply Score: 1

by vermaden on Fri 9th Feb 2007 12:04 UTC
Member since:

check my site for other CLI related tasks:

Reply Score: 1

by Doc Pain on Fri 9th Feb 2007 19:42 UTC in reply to "CLI"
Doc Pain Member since:

Very interesting article (allthough for some tasks grep, sed and awk would be my choice instead of perl). And thanks for the link. It will be very useful for those few chosen who "still" use the command line. :-)

Reply Score: 1