Reputation: 11
I'm relatively novice in Unix Shell Scripting.
How can I run the (following) multiple UNIX commands (put into a script, say "discover.sh", using my_log.txt
input-file just once? Eventually, I would like to create an alias [alias discover1='~/discover.sh'] in my .bashrc.
Like:
$ discover1 my_log.txt
Current script:
/bin/egrep 'Version:|Online \(warning\)|Failed \(offline\)' my_log.txt;
/bin/grep -A7 "syscontrol realmmgr" my_log.txt;
/bin/grep -C2 BIOS my_log.txt;
Upvotes: 0
Views: 491
Reputation: 782489
discover.sh
should contain:
#!/bin/bash
/bin/egrep 'Version:|Online \(warning\)|Failed \(offline\)' "$1"
/bin/grep -A7 "syscontrol realmmgr" "$1";
/bin/grep -C2 BIOS "$1";
The variable $1
is automatically set to the first parameter of the script.
Upvotes: 1