Help with "do shell script"

Hi!
A newbie-at-shell-scripting question.

I’d like move to a directory, then execute a command with a file within this directory, but seems that “do shell script” doesn’t works as terminal. A quick sample would be:

set f_ to quoted form of POSIX path of (choose folder)
do shell script "cd '" & f_ & "'" & (ASCII character 10) & ¬
	"rm " & "file.txt"

But this does not work, and I can’t or don’t want provide a full posix path for “file.txt”…
Does it exists a way to operate as if I was at Terminal? (that’s, cd, then work only with the file name) (such as):[unit0:~] hd% cd desktop
[unit0:~/desktop] hd% rm file.txt

I can’t say for sure but I think I once read that multiple commands could be separated with a semicolin.

JJ,

I think that Technote 2065 answers your question and provides an example. :slight_smile:

Cool tx, Rob! I was lurking for this TN! :smiley:

Clearly the response to linking multiple shell commands together is the use of the semicolon to separate them, but I can’t help wonder why you don’t just:

do shell script ""rm " & f_ & "file.txt"

In other words, pass the entire pathname to rm, rather than changing to the directory and running rm on a local file.

I’m working with a command which accepts a full path as input but not as output… :?: Not pretty sure, but this ways works so good.
Anyway, concatenating some shell commands I win in speed (apart from ‘cd’ stuff…)

Tx!