Re: How do you pass a file path to Automator's "Run Shell Script" action
Re: How do you pass a file path to Automator's "Run Shell Script" action
- Subject: Re: How do you pass a file path to Automator's "Run Shell Script" action
- From: BevInTX <email@hidden>
- Date: Sat, 03 May 2014 05:06:47 -0500
In shell scripts, the $ goes outside of variable braces:
"${1}"
But the braces are not really needed in this situation, as it is the
double quotes that allow special characters in a file name. So the
above is equivalent to:
"$1"
The braces are only required when a positional parameter has more than
one digit, or when a parameter is followed by a character which is not
to be interpreted as part of its name.
use "man bash" for more information.
Bev in TX
On 5/2/14 2:00 PM, Marvin Gardens wrote:
I tried the following line, but it failed so I'm still not getting what
I want.
ln -s "{$1}" /Users/jim/Desktop/
It's probably obvious but I'm learning shell scripting too.
Regards
James
BTW this list seems to have a spam problem. I'm getting a spam for each
post to the list.
On 5/2/14 11:47 AM, Scott Ribe wrote:
echo "{$1}", IIRC
On May 2, 2014, at 12:43 PM, Marvin Gardens <email@hidden> wrote:
Now I've hit a snag. If the path in the variable contains spaces, the
action fails. For AppleScript I use "quoted form of POSIX path to" to
get a quoted path. How do I do that here?
Thanks
James
On 5/2/14 6:44 AM, Aaron Sakovich wrote:
The trick is "Pass input: as arguments", then use the variable $1,
as shown in the attached example.
<Mail Attachment.png>
Aaron
--
Aaron Sakovich
Internet and Technology Services manager
Huntsville-Madison County Public Library
http://hmcpl.org/ -- email@hidden
On May 2, 2014, at 1:55 AM, Marvin Gardens <email@hidden> wrote:
I've been working my way through Ben Waldies Automator book (Snow
Leopard version) and have gotten stuck on how to pass a path from a
"Ask for Finder Items" action to a "Run Shell Script" action. The
workflow has only two steps, Ask for Finder Items ---> Run Shell
Script.
The shell script is simply "ln -s /file/to/input /path/to/output/"
The output path can be hard coded - It will always be the Desktop
folder. Thus far I can't figure out how to put /file/to/input at
the right spot in the script.
With AppleScript, I can use this script saved as a drag and drop
application:
on open (theItem)
set targFile to item 1 of theItem as alias
set QPP to quoted form of POSIX path of targFile
set targFolder to quoted form of POSIX path of (path to desktop
folder)
set shellScpt to "ln -s " & QPP & " " & targFolder
do shell script shellScpt
end open
I can also use this script in a "Run AppleScript" action in Automator:
Ask for Finder Items ---> Run AppleScript
on run {input, parameters}
set input to quoted form of POSIX path of input
set targFolder to quoted form of POSIX path of (path to desktop
folder)
set shellScpt to "ln -s " & input & " " & targFolder
do shell script shellScpt
end run
However, I'd sure like to learn how to do it in the shell with
Automator if anyone can help me.
Thanks
James
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden