Tiny Core Linux

Tiny Core Base => TCB Bugs => Topic started by: uggla on May 01, 2012, 03:27:41 PM

Title: ondemand script strips quotes
Post by: uggla on May 01, 2012, 03:27:41 PM
The present ondemand scripts that tc creates removes quotes around user typed command line parameters.
Code: [Select]
#!/bin/sh
SAVE_ARGS=$*
TCEDIR=/etc/sysconfig/tcedir
if [ ! -e /usr/local/tce.installed/app ]; then
  tce-load -is $TCEDIR/optional/app.tcz
fi
[ $(which app) ] && exec  app ${SAVE_ARGS}

Because of that this command doesn't work:

Code: [Select]
ondemandapp "/home/tc/dir with spaces/file"
The ondemand script should instead look like this:
Code: [Select]
#!/bin/sh
for arg do
case ${arg:0:1} in
-) SAVE_ARGS="${SAVE_ARGS} ${arg}";;
/) SAVE_ARGS="${SAVE_ARGS} \"${arg}\"";;
*) SAVE_ARGS="${SAVE_ARGS} \"$PWD/${arg}\"";;
esac
done
TCEDIR=/etc/sysconfig/tcedir
if [ ! -e /usr/local/tce.installed/app ]; then
  tce-load -is $TCEDIR/optional/app.tcz
fi
[ $(which app) ] && exec  app ${SAVE_ARGS}
Title: Re: ondemand script strips quotes
Post by: uggla on May 01, 2012, 05:18:45 PM
Sorry, this one actually works:

Code: [Select]
#!/bin/sh
TCEDIR=/etc/sysconfig/tcedir
if [ ! -e /usr/local/tce.installed/app ]; then
  tce-load -is $TCEDIR/optional/app.tcz
fi
[ $(which app) ] && exec app "$@"
Title: Re: ondemand script strips quotes
Post by: roberts on May 01, 2012, 07:39:29 PM
I still cringe when I see spaces in filenames. I mean three extra keystrokes and even to have to hold down the Shift key! For what, I say.  Either your a very fast typist or a masochist. Still cringing!

It will be incorporated. Actually I plan to streamline ondemand in 4.6, I hope you will be willing to test your "spaces" during the release candidate cycle and not wait until a day one event as many did with 4.5
Title: Re: ondemand script strips quotes
Post by: solorin on May 01, 2012, 11:03:25 PM
unix = worn nubbins of names
Title: Re: ondemand script strips quotes
Post by: roberts on May 02, 2012, 03:05:52 AM
Yeah, but today, with all the "texting" you would think quotes and spaces are even less used. And likely many words I would not even understand.
Title: Re: ondemand script strips quotes
Post by: roberts on May 02, 2012, 03:06:59 AM
@uggla. Seems tce-run will also benefit.
Title: Re: ondemand script strips quotes
Post by: uggla on May 02, 2012, 06:26:09 AM
Sounds great! I promise to test  ;)