Bash: Difference between revisions
Jump to navigation
Jump to search
Line 15: | Line 15: | ||
* [[dns_subnet]] - find all known DNS entries for class C subnet | * [[dns_subnet]] - find all known DNS entries for class C subnet | ||
* [[get_mac]] - get the current MAC address for an IP address | * [[get_mac]] - get the current MAC address for an IP address | ||
== Looping == | |||
<pre> | |||
sh_files=$(ls -d *.sh 2>/dev/null) | |||
for my_file in "${sh_files[@]}"; do | |||
echo "$my_file" | |||
done | |||
</pre> |
Revision as of 23:17, 4 February 2015
Online Documentation
- Advanced Bash-Scripting Guide: http://tldp.org/LDP/abs/html/
- Another tutorial: http://pegasus.rutgers.edu/~elflord/unix/bash-tute.html
Parse command-line arguments
for arg in "$@"; do
# do something with arg
done
bash script examples
- dicom_dir_to_analyze - convert all Analyze files in a directory tree to DICOM format
- dns_subnet - find all known DNS entries for class C subnet
- get_mac - get the current MAC address for an IP address
Looping
sh_files=$(ls -d *.sh 2>/dev/null) for my_file in "${sh_files[@]}"; do echo "$my_file" done