I want to call a variable to find the current user ID within an expect shell script:
set pass "password"
set username [id -un]
spawn scp -r root@serveraddress:/var/scpserver /Users/$username/Library/Songs/song.mp3`
Mac:TestDir Matthew$ ./tester.sh
invalid command name "id"
while executing "id -un"
invoked from within
"set username [id -un]"
(file "./tester.sh" line 3)`
id -un is a system command, not a Tcl command. You should use
exec to execute any system command.
set username [exec id -un]
Instead of this way, you can rely on the Tcl's inbuilt
tcl_platform(user) variable to get the current username.