WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: ondemand script strips quotes  (Read 2474 times)

Offline uggla

  • Sr. Member
  • ****
  • Posts: 438
ondemand script strips quotes
« on: May 01, 2012, 12: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}
« Last Edit: May 01, 2012, 01:46:58 PM by uggla »

Offline uggla

  • Sr. Member
  • ****
  • Posts: 438
Re: ondemand script strips quotes
« Reply #1 on: May 01, 2012, 02: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 "$@"

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: ondemand script strips quotes
« Reply #2 on: May 01, 2012, 04: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
10+ Years Contributing to Linux Open Source Projects.

Offline solorin

  • Full Member
  • ***
  • Posts: 184
Re: ondemand script strips quotes
« Reply #3 on: May 01, 2012, 08:03:25 PM »
unix = worn nubbins of names
. . . if you don't know, now you know. . .
        ----- R.I.P. Biggie Smalls -----

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: ondemand script strips quotes
« Reply #4 on: May 02, 2012, 12: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.
10+ Years Contributing to Linux Open Source Projects.

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: ondemand script strips quotes
« Reply #5 on: May 02, 2012, 12:06:59 AM »
@uggla. Seems tce-run will also benefit.
10+ Years Contributing to Linux Open Source Projects.

Offline uggla

  • Sr. Member
  • ****
  • Posts: 438
Re: ondemand script strips quotes
« Reply #6 on: May 02, 2012, 03:26:09 AM »
Sounds great! I promise to test  ;)