Page 1 of 1

Shell script problem

PostPosted: 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.

Re: Shell script problem

PostPosted: 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.

Re: Shell script problem

PostPosted: 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 & "' "