Removing the quote distinction?
Posted May 19, 2005 11:41 UTC (Thu) by
liljencrantz (subscriber, #28458)
In reply to:
Removing the quote distinction? by kleptog
Parent article:
Fish - The friendly interactive shell
Hmm... I've never written scripts that do a huge amount of mixed string and variable output, so I never thought about the issues you describe. The way things work now, you'd either have to write:
echo "Couldn't open file: "$file
and
echo "Looking for /home/"$USER/$filename
which are _exactly_ the same length as the bash equivalent, but might feel unintuitive, or you could write:
printf "Couldn't open file: %s\n" $file
and
printf "Looking for /home/%s/%s\n" $USER $filename
which in my opinion look nice and clear, but they are slightly longer. It seems to me that for any complex formating, the power and clarity of printf far outweighs the brevity of echo and variables in quoted strings. But I might be wrong. You are more than welcome to try and persuade me that I am wrong.
(
Log in to post comments)