James Francis wrote:
I'll second that - learn to code Korn Shell. There are a few minor differences between bash and ksh, but they are not too big, and ksh is the better shell for script coding. Also the Korn Shell book gives you good ideas about script coding style, which I find important.Arden Norder wrote:Hey folks!! Can anyone help me with a book title for Unix/Linux Scripting?? I used to (back in the DOS days) do alot of batch scripting using variables etc, etc, etc. I would like to try to automate some processes on my RH7.2 Server via unix batch scripting. Any help would be greatly appreciated Regards / Met vriendelijk groet, ArdenMy favorite of all time is the The KornShell by David Korn. The Korn shell is on all Unix systems, and the concepts and coding work equally well under GNU's bash.
And before anybody starts screaming their head off over my saying that ksh is better than bash, let me say that I think bash is a better interactive shell. But in bash you'll occasionally run into some minor inconveniences, like (this is from memory - correct me if I'm wrong):
IFS=':'
cat /etc/passwd | while read a b c d
do
if [[ "$a" == "root" ]]
then
export NAME="$c"
fi
done
- in ksh this will export NAME into your current env, but not in bash. The explanation, I understand, is that when you start a pipeline in ksh, the last command in the pipeline (here: where ...) runs in the current shell, but in bash all the commands in a pipeline run in a subshell.
As I said this is only a minor annoyment, but it does mean that in bash you have to use an intermediate file:
IFS=':'
cat /etc/passwd > tempfile
while read a b c d
do
if [[ "$a" == "root" ]]
then
export NAME="$c"
fi
done < tempfile
rm tempfile
This is more bother because you have to invent a filename that hopefully doesn't clash with an existing file, and you have to delete it afterwards. Plus it is logically unnecessary, simply.
/jan
--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list