Re: syntax problem in /etc/csh.login
Colin J. Raven wrote: +> > if [ `whoami` = test ]; then +> > echo "" +> > echo -e "This is a test message for user test" && \ +> > echo "" +> > fi +> > ### +> > +> > and got an error upon subsequent login as user "test": +> > "if: Expression Syntax." (without parens) +> > +> > Anyone got any idea what I'm doing wrong? +> > Guess: csh syntax is different from bash +> +> You're right! Well, thanks! +> > but beyond that I'm stumped. +> +> beyond that comes 'man csh'. Oh for goodness sakes I am sure it does but reading man csh is a 2 week exercise.which considering I don't normally use csh, but a few of my user opoulation does, it's not likely that I am going to absorb all the huge amount of information in man csh for a shell I never use personally. +> Sorry, but you have to read it yourself! ;-) +> +> Hint: As the name of the shell suggests, the syntax quite C-like. Response to "Hint" Most assuredly your response indicates substantial knowledge of C. Unlike you however, I am not a programmer but "catch on quickly" to most things.and my post was no more than asking someone to "jumpstart me" which usually starts me on a reading binge in FURTHER pursuit of knowledge. Right now I have absolutely no clue as to where to begin. On this list of all places, I did not expect the supercilious "RTFM" response. It's uncalled for, it's unecessary and furthermore does not speak well of your willingness to be of assistance to those less knowledgeable than yourself. Instead it smacks of a (largely useless) demonstration of what *you* know and others *don't* know. I wonder...seriouslyI wonder why you even elected to respond at all Remaining silent would have been the elegant solution. Hey man, cool down :-) man pages *are* the primary source of information. Also i don't know the csh syntax myself (only use sh/bash), that's why i referred you to the man page. I also have *very* limited knowledge about C, but the name "c-shell" really comes from C. This happens to be one of the things that i remember from my first UNIX course some 10 years ago. The csh man page is in fact very long, but you don't have to read it completely. I had a look into it myself, by browsing and searching (use the "/" (slash) button) one can find the "if" syntax quite quickly. Sorry for having hurt your feelings :-) Kond regards, Heinrich To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-questions" in the body of the message
Re: syntax problem in /etc/csh.login
On Fri, Feb 14, 2003 at 02:40:17PM +0100, Colin J. Raven typed: > > +> > if [ `whoami` = test ]; then > +> > echo "" > +> > echo -e "This is a test message for user test" && \ > +> > echo "" > +> > fi > +> > ### > +> > > +> > and got an error upon subsequent login as user "test": > +> > "if: Expression Syntax." (without parens) > +> > > +> > Anyone got any idea what I'm doing wrong? > +> > Guess: csh syntax is different from bash > +> > +> You're right! > Well, thanks! > > +> > but beyond that I'm stumped. > +> > +> beyond that comes 'man csh'. > Oh for goodness sakes > > I am sure it does but reading man csh is a 2 week exercise.which > considering I don't normally use csh, but a few of my user opoulation > does, it's not likely that I am going to absorb all the huge amount of > information in man csh for a shell I never use personally. I agree the csh manpage is quite large. But what about google? The first hit in a search for "csh conditional statements" is a tutorial with examples of exactly what you're asking. > +> Sorry, but you have to read it yourself! ;-) > +> > +> Hint: As the name of the shell suggests, the syntax quite C-like. > > Response to "Hint" > Most assuredly your response indicates substantial knowledge of C. > Unlike you however, I am not a programmer but "catch on quickly" to most > things.and my post was no more than asking someone to "jumpstart me" > which usually starts me on a reading binge in FURTHER pursuit of > knowledge. Right now I have absolutely no clue as to where to begin. > > On this list of all places, I did not expect the supercilious "RTFM" > response. It's uncalled for, it's unecessary and furthermore does not > speak well of your willingness to be of assistance to those less > knowledgeable than yourself. Instead it smacks of a (largely useless) > demonstration of what *you* know and others *don't* know. On the other hand, you might do >some< research before asking a question, especially since it was not a FreeBSD specific question. > I wonder...seriouslyI wonder why you even elected to respond at > all Remaining silent would have been the elegant solution. > > Regards to all - as always. > -Colin > > > > > To Unsubscribe: send mail to [EMAIL PROTECTED] > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-questions" in the body of the message
Re: syntax problem in /etc/csh.login
On Fri, Feb 14, 2003 at 01:10:15PM +0100, Colin J. Raven wrote: > Greetings all! > Trying to create a custom login message for csh users. > I put the following in /etc/csh.login > > ### > if [ `whoami` = user1 ]; then > echo "" > echo -e "This is a test message for user1" && \ > echo "" > else > if [ `whoami` = user2 ]; then > echo "" > echo -e "This is a test message for user2" && \ > echo "" > else > if [ `whoami` = test ]; then > echo "" > echo -e "This is a test message for user test" && \ > echo "" > fi > ### > > and got an error upon subsequent login as user "test": > "if: Expression Syntax." (without parens) > > Anyone got any idea what I'm doing wrong? > Guess: csh syntax is different from bash but beyond that I'm stumped. Further guess (but informed by a brief read-up in UNIX in a Nutshell): The conditions for an 'if' statement should be enclosed in parentheses, rather than using the [ or test. However, it may still do funky stuff with the command substitution... The block syntax for "if" statements is: if (expr) then cmds endif === if (expr) then cmds else cmds endif == if (expr) then cmds else if (expr) then cmds2 else cmds3 endif HTH, Dan -- Daniel Bye PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc PGP Key fingerprint: 3D73 AF47 D448 C5CA 88B4 0DCF 849C 1C33 3C48 2CDC _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-questions" in the body of the message
RE: syntax problem in /etc/csh.login
+> > if [ `whoami` = test ]; then +> > echo "" +> > echo -e "This is a test message for user test" && \ +> > echo "" +> > fi +> > ### +> > +> > and got an error upon subsequent login as user "test": +> > "if: Expression Syntax." (without parens) +> > +> > Anyone got any idea what I'm doing wrong? +> > Guess: csh syntax is different from bash +> +> You're right! Well, thanks! +> > but beyond that I'm stumped. +> +> beyond that comes 'man csh'. Oh for goodness sakes I am sure it does but reading man csh is a 2 week exercise.which considering I don't normally use csh, but a few of my user opoulation does, it's not likely that I am going to absorb all the huge amount of information in man csh for a shell I never use personally. +> Sorry, but you have to read it yourself! ;-) +> +> Hint: As the name of the shell suggests, the syntax quite C-like. Response to "Hint" Most assuredly your response indicates substantial knowledge of C. Unlike you however, I am not a programmer but "catch on quickly" to most things.and my post was no more than asking someone to "jumpstart me" which usually starts me on a reading binge in FURTHER pursuit of knowledge. Right now I have absolutely no clue as to where to begin. On this list of all places, I did not expect the supercilious "RTFM" response. It's uncalled for, it's unecessary and furthermore does not speak well of your willingness to be of assistance to those less knowledgeable than yourself. Instead it smacks of a (largely useless) demonstration of what *you* know and others *don't* know. I wonder...seriouslyI wonder why you even elected to respond at all Remaining silent would have been the elegant solution. Regards to all - as always. -Colin To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-questions" in the body of the message
Re: syntax problem in /etc/csh.login
Colin J. Raven wrote: Greetings all! Trying to create a custom login message for csh users. I put the following in /etc/csh.login ### if [ `whoami` = user1 ]; then echo "" echo -e "This is a test message for user1" && \ echo "" else if [ `whoami` = user2 ]; then echo "" echo -e "This is a test message for user2" && \ echo "" else if [ `whoami` = test ]; then echo "" echo -e "This is a test message for user test" && \ echo "" fi ### and got an error upon subsequent login as user "test": "if: Expression Syntax." (without parens) Anyone got any idea what I'm doing wrong? Guess: csh syntax is different from bash You're right! but beyond that I'm stumped. beyond that comes 'man csh'. Sorry, but you have to read it yourself! ;-) Hint: As the name of the shell suggests, the syntax quite C-like. Regards & TIA, -Colin Reegards Heinrich -- Heinrich Rebehn University of Bremen Physics / Electrical and Electronics Engineering - Department of Telecommunications - E-mail: mailto:[EMAIL PROTECTED] Phone : +49/421/218-4664 Fax :-3341 To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-questions" in the body of the message
syntax problem in /etc/csh.login
Greetings all! Trying to create a custom login message for csh users. I put the following in /etc/csh.login ### if [ `whoami` = user1 ]; then echo "" echo -e "This is a test message for user1" && \ echo "" else if [ `whoami` = user2 ]; then echo "" echo -e "This is a test message for user2" && \ echo "" else if [ `whoami` = test ]; then echo "" echo -e "This is a test message for user test" && \ echo "" fi ### and got an error upon subsequent login as user "test": "if: Expression Syntax." (without parens) Anyone got any idea what I'm doing wrong? Guess: csh syntax is different from bash but beyond that I'm stumped. Regards & TIA, -Colin To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-questions" in the body of the message