The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - General (http://hintsforums.macworld.com/forumdisplay.php?f=16)
-   -   Help in UNIX (http://hintsforums.macworld.com/showthread.php?t=31468)

ezmobius 12-14-2004 12:58 AM

When you quoted the variable it expands to look like this if you had selected a 2 name file with a space:
'file name'
This 'hides the space from the command line. So your script works. Whenever you write scripts that have variables that might expand into strings with spaces or weird characters. This way no matter what you throw at the script(within reason) will still be handled as you intended.

bjast 12-17-2004 02:32 PM

That's a very helpful insight!

Thanks,

bjast

schwie 03-02-2005 01:00 AM

Bash, inputbox, and variable
 
I haven't been able to find anything in this forum, the CocoaDialog
documentation, or on the web about setting variables in a shell script
through user input and then working with the data.

I'd like to be able to take user input via an inputbox or
standard-inputbox in a shell script and set a variable without the button information embedded in the variable. Can anyone explain to me how to do this?

I was able to use the Perl examples for a standard-inputbox and
inputbox to set a variable, but here's my problem. The variable is
set, but the first line of the variable has the number of the button
that was pressed and then the input data (the data I really care about)
is stuck on the second line of the variable. How do I set the
variable so that just the input data is contained? Does the shell have
a way to split data up like Perl does? Maybe I need to use pipes... Maybe I need to look at more shell examples on the web?


All times are GMT -5. The time now is 06:00 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.