Created
December 18, 2018 13:00
-
-
Save byJeevan/c41efbc0eeeb5c722160cecda83b4ef7 to your computer and use it in GitHub Desktop.
This gist contains the collection of shell scripts for reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#*****Reading ******# | |
#From user | |
read -p "Enter Name: " userName | |
echo $userName | |
#From text file - line by line | |
while read line; do | |
echo $line | |
done < en.txt | |
#Convert string (by split with ;) to array | |
csvStr="a,b,c" | |
IFS=',' read -ra itemArray <<< "$csvStr" | |
#***** PRINTING ****# | |
#Print first item in the array | |
echo "FIRST ITEM -- > ${itemArray[0]}" | |
#Print all items from array | |
for i in "${itemArray[@]}"; do | |
echo $i | |
done | |
# | |
echo "Completed !!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment