On 3/18/07, Simon Edwards <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I was converting a bash script to fish and noticed that the pwd command
> in fish doesn't expand the ~ character. For example:
>
> [EMAIL PROTECTED] ~]$ cd devel
> [EMAIL PROTECTED] ~/devel]$ pwd
> ~/devel
>
> in bash:
>
> [EMAIL PROTECTED] ~/devel]$ bash
> [EMAIL PROTECTED]:~/devel$ pwd
> /home/sbe/devel
> [EMAIL PROTECTED]:~/devel$
>
> is there a reason for this difference?

I find the ~ makes the string easier to parse. It is also (arguably)
more information in less space. Also, fish handles symlinks in pwd
differently from e.g. bash for reasons outlined at

http://fishshell.org/user_doc/faq.html#faq-cwd-symlink

so pwd works inherently differently on fish, meaning that an
incompatible change is less of a deal than it would be normally.

I hadn't really though about the issue of using pwd in scripts,
though. I would say that is a good enough reason to scrap the use of
~. One possibility is to use ~ only if stdout is a terminal, much like
e.g. ls does with --color=auto, or how the mysql client behaves by
default. Opinions are welcome.

For now, if you want to disable the use of ~, cut and paste the
following code into the commandline:

function pwd
echo $PWD
end
save_function pwd


> (Axel, thanks for making a sane shell. It is good to see someone have a
> go at improving on the design of the traditional unix-style shell and
> fixing some of its fundamental flaws).

Thank you! I'm always delighted to hear from happy fish users.

>
> cheers,
>
> --
> Simon Edwards             | KDE-NL, Guidance tools, Guarddog Firewall
> [EMAIL PROTECTED]       | http://www.simonzone.com/software/
> Nijmegen, The Netherlands | "ZooTV? You made the right choice."

-- 
Axel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to