LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-02-2005, 12:02 PM   #31
ioerror
Member
 
Registered: Sep 2005
Location: Old Blighty
Distribution: Slackware, NetBSD
Posts: 536

Rep: Reputation: 34

Quote:
Regarding zsh, I avoid it because it handles quoted arguments differently to every other Bourne-based shell
Differently? No, I think you mean _properly_.

Zsh does not automatically perform word splitting on quoted arguments (which, by definition, are intended to be a single argument). This behaviour of bash et al is DEFECTIVE. What other language mangles parameters like this? This is the reason I switched to zsh over 4 years ago, and I haven't looked back.

By the way, you can make zsh do automatic word splitting by setting the sh_word_split option (see also the 'emulate' builtin). You can do work splitting on a single parameter with ${=param} ...

Quote:
And regarding using stat instead of ls, be aware that stat is Linux only,
Bugger, I wasn't aware of that, thanks for pointing that out.

However, I see your point and I raise you the fact that zsh has it's own builtin version of stat! Who's portable now?

OK, joking aside, I agree, zsh isn't fully bourne compatible (see the wildly different read builtin for example), so bash is better if you do want/need to write a reasonably portable script. But, of course, the shell you use for (portable) scripts and the shell you use interactively don't have to be the same...
 
Old 12-02-2005, 03:53 PM   #32
linmix
Senior Member
 
Registered: Jun 2004
Location: Spain
Distribution: FC5
Posts: 1,993

Original Poster
Blog Entries: 1

Rep: Reputation: 46
I've received the following suggestion for my sed question:
Code:
ls -l $dir | grep ^- | sed -e 's/.* //g'
Which works great (why it does beats me though) so that's one more question solved... more or less. I hope to get some time this weekend to include some ideas I've been jotting down as they came to me at all the wrong moments
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Prepend # for certain line numbers in VI twantrd Linux - Software 3 09-05-2005 01:27 PM
prepend char to a string schneidz Programming 6 06-01-2005 08:53 AM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
bash script - incrementing a filename in a script tslinux Programming 10 08-05-2003 11:58 PM
bash script prob: how can i tell the script that a 'dd' has finished? Frustin Linux - General 2 04-02-2003 05:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration