####
The BASH and Bourne shell has a poorly documented feature that its termination status is 128 plus the signal number.####
2>&1 means descriptor 2 is a copy of descriptor 1. dup2(1, 2);
exec 3>&1 # Save current "value" of stdout.
ls -l 2>&1 >&3 3>&- | grep bad 3>&- # Close fd 3 for 'ls' and 'grep'.
exec 3>&- # Now close it for the remainder of the script.
stty tostop
Disable ability of background jobs to output to controlling terminal.
####
ls 有一个 F 选项哦
####
ln -s /some/dir .
把/some/dir下的所以文件软链接到当前目录
####
$command 5<>tmp
The clause 5<>tmp opens the file tmp for reading & writing on file descriptor 5.
####
if [ `pwd` == "$LOG_DIR" ]
pay attention to the blanks between every element of the statement.
####
$*
All of the positional parameters, seen as a single word
$@
Same as $*, but each parameter is a quoted string, that is, the parameters are passed on intact, without interpretation or expansion. This means, among other things, that each parameter in the argument list is seen as a separate word.
####
#!/bin/bash
# Using 'shift' to step through all the positional parameters.
# Name this script something like shft,
# and invoke it with some parameters, for example
# ./shft a b c def 23 skidoo
until [ -z "$1" ] # Until all parameters used up...
do
echo -n "$1 "
shift
done
echo # Extra line feed.
exit 0
if [ -n "$1" ]
# Test if command line argument present (non-empty).
####
select vegetable in "beans" "carrots" "potatoes" "onions" "rutabagas"
do
echo
echo "Your favorite veggie is $vegetable."
echo "Yuck!"
echo
break # if no 'break' here, keeps looping forever.
done