scripting:sh
This is an old revision of the document!
Bourne Shell
Loop through multi line text (including spaces)
while read LINE do echo "${LINE}" done <<< "`printf "line1\nline2"`"
or in bashish with command output:
while read LINE do echo "${LINE}" done <<< "$(ls -1)"
Calculations
awk
echo 3.14158 2.348 | awk '{ printf("%f\n", $1/$2) }' echo "" | awk '{ printf("%i\n", 10+5) }'
bc
echo "$charge_percent" | bc -l
bash
result=$((30*1000/60))
scripting/sh.1403031793.txt.gz · Last modified: 2014-12-18 20:10 (external edit)