Intial commit of source code samples for GitHub repo.
This commit is contained in:
parent
5793080047
commit
9462407ba8
14 changed files with 397 additions and 1 deletions
27
bash/hello.sh
Executable file
27
bash/hello.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Sample Hello World! bash script...
|
||||
#
|
||||
|
||||
declare -A FRUIT_COLOR
|
||||
|
||||
FRUIT_COLOR=( ["apple"]="red" ["banana"]="yellow")
|
||||
VERINFO=`git describe --abbrev=7 --dirty --always --tags`
|
||||
|
||||
|
||||
# Obligatory Hello World with some version info
|
||||
echo "Hello Bash World! Version: $VERINFO"
|
||||
|
||||
# Show list of command line arguments
|
||||
echo "Command line args: $*"
|
||||
|
||||
# Determine number of physical CPU sockets
|
||||
SOCKETCOUNT=`cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l`
|
||||
echo "CPU socket count: $SOCKETCOUNT"
|
||||
|
||||
# print out our FRUIT_COLOR associative array (key/value pairs)
|
||||
declare -A sorted_fruit
|
||||
for fruit in "${!FRUIT_COLOR[@]}"; do
|
||||
echo "$fruit = ${FRUIT_COLOR["$fruit"]}";
|
||||
done | sort --reverse
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue