Sorry, I should have said this, the directory I try to access is not
but the root one:
that's why my path is /Applications/Google Chrome
tried double quoting but still get this:
---------- Post updated at 12:02 PM ---------- Previous update was at 11:39 AM ----------
I'll try to explain better myself
my path variable do a command that with a query of "Google C" outputs this:
when I do:
works like a charm with names with no spaces like:
But when the name have spaces it seems like it misleads the search to my user application directory:
when I use the doble quotes even the single named Applications get mislead to my user directory
I don't think the contents of your variable are what you think they are.
1) Show your code, please, all of it.
2) Don't use 'path' or 'PATH' as variable names, PATH is a special variable controlling where commands are found, changing it will cause problems.
The way you're setting path is clearly injecting leading spaces. So when an application without spaces, using unquoted expansion, the variable containing path=" someapp" would expand from open $path to open someapp. because of word splitting the leading/trailing whitespace are gone.
now you want to preserve spaces in your variable, and you quote the expansion.... those spaces are still there as i can tell from
So the fault is with how you are obtaining that variable.
I do not use Mac OS X but I assume ps takes BSD options. You can have it print just the command line! Is pgrep available? I'd suggest using pgrep to get the pids of matching processes, then use ps -p $pid -o cmd=
Last edited by neutronscott; 07-27-2012 at 02:43 PM..
I have a script that must perform a 'sudo' operation on each of a number of hosts. I'm trying to get expect working so I only have to enter it once, and have run into a couple of issues.
First, several examples suggest to use:
/usr/bin/expect <<EOD
spawn ssh -t $host /usr/bin/sudo -v... (7 Replies)
I have a script that writes another script with
cat >/usr/local/bin/myscript.sh <<EOF
#!/bin/sh
VAR=`run a command here`
EOF
Problem is, after this is run, I get:
$ cat /usr/local/bin/myscript.sh
#!/bin/sh
VAR=result of command
How do I stop that from happening with Macs... (2 Replies)
Hi there,
Hope this isn't too complex of a script to try to make but this is what I'm trying to do.
Create a new group and add local users that aren't admin to the group.
So let's say the new group is 'cats' and 'dog' is the only admin on the machine. Let's say most machines only have one... (4 Replies)
i am having a weird error on mac os x running some shell scripts. i am a complete newbie at this and this question concerns 2 scripts. one of which a friend of mine wrote (videochecker.sh) a couple weeks ago and it's been running fine on another machine.
then last week i wrote capture.sh and it... (2 Replies)
Can someone please help me with my bourne shell script. I am a struggling newbie. I need create a script that will read an argument from a command line, access a config file with application file types, and open the file with the correct application. The file needs to be able to handle file... (3 Replies)
Hi,
I have installed bash 3.2 via darwin ports, however when I try and change the shell i.e. chsh -s /opt/local/bin/bash is says its a non-standard shell? but if i run ./bash i get a new bash prompt with version 3.2?
Thanks (3 Replies)
If I do a netstat -a I can see all the sockets currently open, is there a way that I can tell which application is holding open these sockets ? (3 Replies)
Hi, We need to build an application for work that will run on OSX. It will be fairly simple, in which the user will use a mouse to grab objects on the screen and move them to a target location. The program will need to record information about accuracy and speed, and output that data at the end.
... (1 Reply)