LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] C shell syntax

[ILUG] C shell syntax

Colm Buckley colm at tuatha.org
Tue Jul 10 13:46:12 IST 2001


On Tuesday 10 July 2001 13:24, you wrote:

> Does anyone know why this doesn't work within a C shell script:
>
>      set user = `id -u`
>      set group = `id -g`
>      chown $user:$group files
>
> I get a 'Variable syntax' error message as it doesn't seem to like having a
> variable for the user id.
>
> Unfortunately I have to use C shell - standards!

Yep.  The ":" operator performs operations on a variable - see the csh
man page for details.  You can protect the variable by putting the
name in {} - in your example above, "chown ${user}:${group} files"
should work.

CSH is *horrible*, though.

Hope this helps,

          Colm

-- 
Colm Buckley @ NewWorld Commerce
Business: +353 1 4334334  / colm at nwcgroup.com / http://www.nwcgroup.com/
Personal: +353 87 2469146 / colm at tuatha.org / http://www.tuatha.org/~colm/
Two wrongs are only the beginning.




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell