Hi,
We are running into issue with Script Parameters while adding it with the script. It works fine if we call that in the script, but when I run any command as currently logged in user the parameter variable $4 does not work.
For Example
I am specifying the string "TEST" in Parameter 4 Not Labeled while adding the script. When I call $4 in the script directly it works, but I need to run a command as currently logged in user. When I echo $4 as currently logged in user, its blank.
My Script is to send an email based on the Script Parameter specified at Paramater 4($4).
#!/bin/sh
echo $4 # this echoes "TEST"
LOGGEDUSERS=`who | awk '/console/ {print $1}'`
su -l $LOGGEDUSERS -c 'echo "$4 Contents" | mail -s "Success" admin@test.com' # this triggers the mail but $4 value is blank in email
Is there any way to call the script parameters while running the command as logged in user?
Regards,
Karthikeyan