Skip to content

Instantly share code, notes, and snippets.

@wcc526
Last active October 11, 2015 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wcc526/0fc089f89fc6f5a7535a to your computer and use it in GitHub Desktop.
Save wcc526/0fc089f89fc6f5a7535a to your computer and use it in GitHub Desktop.
bash tutorial
#!/bin/bash
OF=myhome_directory_$(date +%Y%m%d).tar.gz
tar -czf $OF /home/linuxconfig
#!/bin/bash
#Declare array with 4 elements
ARRAY=( 'Debian Linux' 'Redhat Linux' Ubuntu Linux )
# get number of elements in the array
ELEMENTS=${#ARRAY[@]}
# echo each element in array
# for loop
for (( i=0;i<$ELEMENTS;i++)); do
echo ${ARRAY[${i}]}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment