LWN.net Logo

Advertisement

E-Commerce & credit card processing - the Open Source way!

Advertise here

Fish - The friendly interactive shell

Posted Jun 1, 2005 19:29 UTC (Wed) by kjetilho (guest, #30261)
In reply to: Fish - The friendly interactive shell by liljencrantz
Parent article: Fish - The friendly interactive shell

It would be bad to make the behaviour in scripts different from that in interactive use, often I just paste my recent command history and make it a script for later use. The obviously correct ;-) solution is to make globbing work differently in list context, ie. when used as an iterator in for loops.

Doing this correctly in bash is quite painful -- you need to handle case where the glob matches literally:

  for i in *.c; do
    [ "$i" = "*.c" -a ! -e "$i" ] && break
    do_stuff "$i"
  done

fish sure is neater:

  for i in *.c; do_stuff $i; end


(Log in to post comments)

Fish - The friendly interactive shell

Posted Jun 9, 2005 12:11 UTC (Thu) by liljencrantz (subscriber, #28458) [Link]

So many solutions to a single problem. What is really needed is a 'Do what i mean' command...

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.