How to pass a parameter in a command without run the parameter content?
1
vote
2
answers
848
views
Good days.
I have a little problem.
I have this function in bash script
function denyCheck(){
file=$(readlink -f $(which $(printf "%s\n" "$1")))
if [[ -x $file ]];then
return false
else
return true
fi
}
denyCheck "firefox"
This function I pass her a string, what is a comman, and this resolv the orginal path where is the command (by example: /usr/lib/firefox/firefox.sh) and if the file is executable return true else false.
But the problem is...The parameter (in the example "firefox") run it as command and open the browser firefox.
How can I do for that the parameter not run it?
Thank you very much.
Asked by cleanet
(13 rep)
May 14, 2022, 10:21 AM
Last activity: May 14, 2022, 05:15 PM
Last activity: May 14, 2022, 05:15 PM