Changes

Jump to: navigation, search

User talk:Bossa nesta

22 bytes added, 07:10, 14 October 2008
BASH SCRIPTING
======================== BASH SCRIPTING ========================
<pre>$ cal 16 2008 2>&1 >all-output.txtrun 'cal' with parameter "16 2008", err out to display/terminal, output to "all-output.txt"
$ cal 16 2008 2>err.txt >all-output.txt
err out to "err.txt", output to file "all-output.txt"
grep "/bin/bash$" /etc/passwd | cut -d: -f1 | sort | mail -s "Bash users" joe@example.com
1. selects all BASH users from the system account file /etc/passwd
$ vi Nes$(date +%Y%m%d)-notes.txt
creat a note with the name started with "Nes" follow by current year, month, date, e.g: "Nes20081012-note.txt'
$ rm "$NAME"
= 'export' to turn variables into environment variables, so, all sub process can use the variable(s)
$ TEST="Yes"
$ bash -c 'echo $TEST'
The test Command
= BASH has a built-in test command (similar to /bin/test) which can perform basic string and integer comparisons using these operators (results are returned as an exit code):
= return 0 or 1, where 0 is true, 1 is false
$ [ ! "a" != "b" ]; echo $?
1
 
======================== BASH FLOW CONTROL ========================

Navigation menu