BladeSystem Forums have moved here
To make BladeSystem information easier to find, we have moved the BladeSystem forums here, to Servers and Operating Systems.
Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

Help with CSH please

Regular Advisor

Help with CSH please

I have the following script that works great in sh/ksh. Can someone please help me with the syntax for csh. I can't get the if statement working.

Thanks

# custom code for denying generic account login
if logname > /dev/null 2>&1
then
LGNM=`logname`
if egrep "^${LGNM}$" /etc/not_loginable > /dev/null 2>&1
then
echo "\nDirect login not allowed for $LGNM\n"
echo "\nNO remote login allowed for $LGNM (`date '+%D %T'`)\n" |
sleep 3
logger -p user.err NOT_LOGINABLE
exit 1
fi
fi
whatever
5 REPLIES
Honored Contributor

Re: Help with CSH please

> Can someone please help me with the syntax
> for csh.

Why csh?

> I can't get the if statement working.

man csh

"fi"? Try "endif".

man csh
Honored Contributor

Re: Help with CSH please

And that's not the only thing you'd need to
change. For example:

> [...] 2>&1
Regular Advisor

Re: Help with CSH please

The script is what I use to lock out "generic" accounts...so that they can only be "su'd" to. We have a few users who are csh and I need to make it work for those accounts
whatever
Regular Advisor

Re: Help with CSH please

Got it.
whatever
Highlighted
Acclaimed Contributor

Re: Help with CSH please

Hi:

> I have the following script that works great in sh/ksh

Then why in the ?!? In HP-UX the Posix shell is your standard. In AIX, Korn is the default; in Linux, the bash shell --- all cousins. Why would you want to rewrite it in the C-shell?

If you haven't read this, you should!

http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

Regards!

...JRF...
Regards!

...JRF...