Creating a service in Automator (Run shell script > Bash) to copy to clipboard filesize (in bytes) of selected file in Finder. I'm not very well versed in bash, and can't see where this is wrong. Aim is to have it appear in the 'services' menu when right clicking a file, and then I can just paste the filesize wherever I fancy. Options I have selected in Automator are:
Service receives selected "files or folders" in "Finder.app"
Shell /bin/bash
Pass input as arguments
for f in "$@"
do
getty=$(ls -l "$f")
done
IFS=' ' read -a newList <<< "${getty}"
echo -n ${newList[4]} | pbcopy
Run Shell Script failed - 1 error:
-: -c: line1: syntax error near unexpected token `do
To make it clearer to everyone, the solution is :
stat -f '%z' "$@" | pbcopy