saving path to link created using 'do shell script' to Applescript var

I’m using the ln command (with do shell script) to create a hard link in a directory.
But how can I save the path of the new file into an applescript variable?

Hi fhill2,

Do you have the path to the source file and target directory in posix form or alias reference?

If you start with the path as alias reference, then you can get the name of the file and then get the path to the link in the target directory.

Edited: here’s an example for first time ln user.

set trg_dir to choose folder
set trg_pp to quoted form of (POSIX path of trg_dir)
set src_file to choose file
set src_pp to quoted form of (POSIX path of src_file)
do shell script "ln " & src_pp & space & trg_pp

tell application "System Events"
	set link_ref to (first file of trg_dir whose name is (name of src_file)) as alias
end tell