I have been using fish as my interactive shell for some time now. And
love the new fish!

I have never really used it for primary scripting other than for
interactive functionality, but for the fun of it, I converted a few sh
scripts I use for batch processing.

One of the things I miss is being able to put commands inside a quoted
string e.g. echo "this is an example (date)" just results in

"this is an example (date)" literally. It would be nice if the
parentheses have to be escaped to do so instead e.g. echo "this is an
example \(date\)" and the command expanded otherwise.

Unless I am missing something, the only way to pass a string with
command expansion is to not use quotes, but to escape the whole string
instead. An example of how messy this can get is this:

In sh I can use

echo "<p><a href=\"$line\">${line%%.html}</a><span 
class=\"opening\">$content</span> ...</p><hr>" >>body

but in fish I had to use

echo \<p\>\<a href=\""$line"\"\>(basename "$line" .html)\</a\>\<span 
class=\"opening\"\>"$content"\</span\> ...\</p\>\<hr\> >>body

which is pretty hard to read, let alone key in correctly the first time! 

Note: 
1. the quotes had to be escaped in order to show despite not being
within a quoted string to produce e.g. <a href=" ... ">
2. the fish variables needed to be quoted as, if the variable string
contained spaces, sometimes only the first word was expanded for $line,
and in the case of $content, fish iterated over the string creating
multiple <span ... > statements per word (an iteration feature of fish
??)

It would be nice to be able to type instead (I think)

echo "<p><a href=\"$line\">(basename "$line" .html)</a> <span 
class=\"opening\">$content</span> ...</p><hr>" >>body

Am I missing something? Of course, I am not sure I would use fish in
place of sh for batch scripts, but the example above is a deterrent for
sure from a readability perspective (unless there is a different way to
do it than how I did).

Fish interactive shell still rocks though!

Keep up the good work, and thanks!
Steven
--

-- 
"Truth or die."

Steven Hum  
5 - 28 Gilmour St  
Ottawa, ON K2P 0N3  
email sdot...@gmail.com  
tel 613.237.9058  
Mobile 613.796.2484  

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to