Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ksh scripting

Status
Not open for further replies.

unixfreak

ISP
Oct 4, 2003
632
0
0
GB

God I hate ksh scripting especially test conditions! I've given up on this one:

if [[ $check -eq 1 && $(`lssec -f /etc/security/limits -s default -a core`)=="default core=0" || $(`lssec -f /etc/security/limits -s default -a core`)=="default core_hard=0" ]]

I've tried a million different ways of putting it and get syntax errors every time. Can someone help me get this one right?

Thanks!
 
hi,

sure there is an error in "Command substitution":

...
To execute command substitution in the Korn shell or POSIX shell, type the following:
$(command)
or, for the backquoted version, type the following:
`command`
...

you have mixed them.



I suggest, when you have troubles, to divide problem in atomic ones:

... if( "a" = "b" )
... if[ "a" = "b" ]
... echo `date`
... echo $(`date`)
... echo $(date)


bye
vic
 

Thanks, it's sound advice but please don't pay attention to the above line too much! I said I've done million things in desperation to it... Just looking for what the line should be like really as I've given up.

It doesn't help that it doesn't respond the same to having stuff in a script or running it on the command line (I've had a friend at a different company verify this, so it's not my system that's broken!) so testing parts of it doesn't work without constantly editing the script.

And yes, I've tried building it up one part after another but it doesn't help and I specifically constantly get errors when I try to have && multiple times with running commands in the tests.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top