while read line do echo $line done <FILEFrom a command output
ls -1d *|while read line do echo $line done
$* - all the command arguments
$# - number of arguments (excludes the command itself)
${@:2} - arguments 2 onwards. E.g. interesting=${@:2}
function print_help {
cat <<EOF
$0 - accounts processing
-d download, decode and store values
-h this help
-m prep, create accounts, enyafi
EOF
}
while getopts "a:h" opt
do
case $opt in
a) echo "$OPTARG" >>$FILE ;; # OPTARG in quotes to preserve spaces
h) print_help ;;
*) echo Unknown option ; print_help ;;
esac
done
if [ "$QUIET" != "-q" ]; then echo ; echo $cmd ; fi
<<< - inline here documents. E.g.
bc <<< "2 * 3" 6
comm takes two file names as arguments. You can treat outputs from other commands as file arguments to comm using a structure like:
comm -12 <(sort names1) <(sort names2)
echo $RANDOMecho $((RANDOM%10))echo $((RANDOM%10+100))Author: Mark Carter Created: 14-May-2011 Updated: 06-May-2013