MJ
asked on
Checking for "*" as input
If I am reading in a text file:
while read -r subdir_to_move subdir_to_make JUNK ; do
how do I check to make sure the first character of each variable is not * ?
while read -r subdir_to_move subdir_to_make JUNK ; do
how do I check to make sure the first character of each variable is not * ?
ASKER
I get a weird error when testing your code! I get a:
./mk.sh[67]: findReplaceStatic.pl: unknown test operator
when ever the first character is an * and it still tests false as if the first character is not a *
Also note that for some reason it lists another script in the directory in the error? The script name I'm testing is mk.sh!
./mk.sh[67]: findReplaceStatic.pl: unknown test operator
when ever the first character is an * and it still tests false as if the first character is not a *
Also note that for some reason it lists another script in the directory in the error? The script name I'm testing is mk.sh!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No need for cut -c1-1
cut -c1
is fine.
cut -c1
is fine.
echo "the first character of $subdir_to_move is an *"
else
echo "the first one is not an *"
fi
and the same to the other variables