Operating System - HP-UX
1834368 Members
2669 Online
110066 Solutions
New Discussion

Problem with simple sh command

 
SOLVED
Go to solution
Alun Territt_1
Occasional Advisor

Problem with simple sh command

Can someone please post a solution to the following:

remsh serverX /usr/bin/grep "fbackup(" logfile
ksh: syntax error at line 1 : `(' unexpected

If I remove the (, then it works fine. If I repeat the command locally (i.e. with remsh) then it also works fine - but for some reason adding remsh causes a problem.

Any suggestions would be appreciated.

Regards

Alun
Some days you fly like a bird, others your the statue.
4 REPLIES 4
Alun Territt_1
Occasional Advisor

Re: Problem with simple sh command

oops, should be "..withOUT remsh.."
Some days you fly like a bird, others your the statue.
Thierry Poels_1
Honored Contributor

Re: Problem with simple sh command

hi,

try
/usr/bin/grep "fbackup\(" logfile
or
/usr/bin/grep 'fbackup(' logfile

good luck,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Ceesjan van Hattum
Esteemed Contributor
Solution

Re: Problem with simple sh command

Hi,

The remsh will interprete the "-quotes by taking the string and then executes the string without the quotes.

Solution:
replace fbackup( by fbackup\(

Reason:
You loose the " by remsh and
then the shell will give you an error (not remsh):

Real cause:
The shell sees (( .. )) as arithmetic expressions and ( .. ) are used to create subshells.

Regards,
Ceesjan
V. V. Ravi Kumar_1
Respected Contributor

Re: Problem with simple sh command

hi,

without \ (back slash) sh treats ( as special character. so to avoid this u should put \ before any special characters, like ( * ? ^ etc.,

here \ is called as escape sequence

regds
Never Say No