Why do I need a semicolon (i.e. ";") in this script?

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
s243a
Posts: 501
Joined: Mon Dec 09, 2019 7:29 pm
Has thanked: 90 times
Been thanked: 37 times

Why do I need a semicolon (i.e. ";") in this script?

Post by s243a »

I created the following script to run synergy in the foreground. I don't understand why the semicons are required:

Code: Select all

#!/bin/sh
xterm -hold -e \
'sh -x -c "echo \"starting synergy server\";
synergys -d WARNING --name puppypc31184 --no-daemon -c ~/synergy.conf;
wait"'
User avatar
MochiMoppel
Posts: 1133
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 18 times
Been thanked: 367 times

Re: Why do I need a semicolon (i.e. ";") in this script?

Post by MochiMoppel »

Because Puppy's xterm script is crap. It removes linefeeds from multiline commands but fails to replace them with semicolons (that's why you have to add them). If you want to play with it, the offending line is

Code: Select all

EXECCOMMAND="`echo -n ${*} | grep -o ' \-e .*' | sed -e 's/ \-e //'`"

The ${*} would require quoting, otherwise echo prints everything on one line, but then grep would have to be fixed too etc. etc.

Why does Puppy still contain this script? Looks like a needless wrapper script for urxvt with many pitfalls. Even in my vintage Slacko 5.6 rxvt knows the -hold option. If the lack of this option once was the only reason for the xterm script, then what's the point of keeping it?

Post Reply

Return to “Programming”