Quote:
|
I can't seem to get that character at the end of line 5? I tried double quotes instead but not working. I'm using korn shell. Any suggestions?
|
That character is a backtick (`). On a UK keyboard at least, it is underneath the escape key, above tab. Commands between 2 backticks are substituted for their equivalent output and substituted into the current command. You could also use $(command).
[q]for next in `echo $list | awk '{ for(i = 1; i <= NF; ++i) print $i}'`[\q]
The line above is saying to echo the value of list, pipe this value into awk and then loop through each field passed into awk, print it out an dthen substitute the final value into the current command, i.e.
for next in outputFromEchoAwkCommand
do
...
A bit pointless really because this is effectively the same as...
for next in $list
do
...
A simpler example would be...
list="a b c d e f g h"
echo "Enter value: \c"; read value
for item in $list
do
[ $value != $item ] && newList="$newList $item"
done
list=$newList; echo $list
Or even...
list="a b c d e f g h"
echo "Enter value: \c"; read value
list=$(echo "$list" | sed "s/${value} \{1,\}//g"); echo $list
HTH