|
Prev: jobboersen freiwillige arbeit im ausland stellenangebote Gestalter in fuer visuelles Marketing jobboerse
Next: searching for missing element in an array
From: gdss on 3 Jul 2008 17:27 Hello everyone, I have this simple bash script that reads from standard input and executes some work depending on the input that it has read. The input lines are meant to be in the form of a command followed by an argument. #!/bin/bash read input #these two lines divide input in a first word and the rest; are they safe? command=`echo ${input%% *}` rest=`echo ${input#* }` case $command in print) echo $rest ;; *) echo "wrong command" ;; esac Is is possible for the user to provide something to the standard input and make this script do something different from what it was meant? I often see that the argument of case statement is enclosed in a pair of inverted commas ( case "$command" in ... ); what is the purpose of the inverted commas? Thanks |