Terminal Command into Applescript I have the following terminal command that I want to automate using applescript. I also would like to have a command to cd directories to the folder where I want to apply the command first. After cd to the folder that holds the .pdf files. This code looks at the first letter of the file name and based on that sorts the files into the alphabet folder corresponding to the first letter of the file.

for x in `ls -1 | sed -e 's/^\(.\).*/\1/' | sort -u`; do
mv -i ${x}?* $x
done


How would I go about doing this? I'm a newbie to this. Any insight would be greatly appreciated. I'm willing to learn Applescript, however, I'm not sure where to start to implement this.

Thanks
You can execute shell script directly on OS X, so there's generally no good reason to do that. However, if you really feel like it, you can use do shell script "script" to execute a shell script in AppleScript.