Hello
would appreciate if somebody can post a bash script that checks if the first character of the given string is equal to, say, "a"
thnx in advance
Hello
would appreciate if somebody can post a bash script that checks if the first character of the given string is equal to, say, "a"
thnx in advance
$ echo "unix" | awk 'BEGIN {FS=OFS=""} END { if (!found) print "FAILED" }
$1 == "u" { print "PASSED"; found++ }
'
PASSED
$ echo "unix" | awk 'BEGIN {FS=OFS=""} END { if (!found) print "FAILED" }
$1 == "g" { print "PASSED"; found++ }
'
FAILED
//Jadu
This will work in bash/korn/baurne
str="$*"
case $str in
a*) echo "a found" ;;
*) echo " no a" ;;
esac