Shell script problem

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Shell script problem Wed Aug 08, 2018 3:23 pm • by jayhalleaux
Code: Select all
#!/bin/bash

username=`/usr/bin/ls -ld $1 | /usr/bin/awk '{print $3}'`
exiftool -creator=$username $1
exit $?


I am trying to take the current owner of a PDF and make them the creator so I can extract it later.

Keep getting the following:

Code: Select all
'Exception caught while executing shell script: Couldn't posix_spawn: error 8'


Bash newbie so if there is a better way to do this please let me know. Any help would be appreciated.
jayhalleaux
 
Posts: 6
Joined: Sat Apr 29, 2017 2:41 am

Re: Shell script problem Thu Aug 09, 2018 9:37 am • by Mr_Noodle
Have you tried this script outside of Hazel? Also, I recommend putting $1 in double-quotes ("$1") in case the path has spaces in it.
Mr_Noodle
Site Admin
 
Posts: 11240
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Shell script problem Sat Aug 11, 2018 7:28 pm • by jayhalleaux
could figure out why it was not working in bash. replaced it with this:

Code: Select all
set posixFile to POSIX path of theFile
tell application "Finder" to set username to (owner of theFile) as text
do shell script "/usr/local/bin/exiftool -creator='" & username & "' '" & posixFile & "' "
jayhalleaux
 
Posts: 6
Joined: Sat Apr 29, 2017 2:41 am


Return to Support