Sunday, 4 February 2024

Shell Script

Write to File

#test.txt file will have content: Hello Word How are you (two lines)
cat << EOF >test.txt
Hello World
How are you
EOF

parameters

//test.sh
!/bin/bash
echo Paramters you pass are $1 and $2

//to call: sh test.sh good bad
//output: Paramters you pass are good and bad

Format Shell Script

shfmt -l -w test.sh