Bash Question

Open a a Linux-Binary in a Shell-File (*.sh)

so, I'm trying to execute a Program with sudo-permissions.

i programmed this script:

echo "Bestätigen sie ihr Passwort, damit der Compiler mit erhöhten Rechten gestartet werden kann"
[ "$(whoami)" != "root" ] && exec sudo -- "$0" "$@"
sudo ~./Compiler/Compiler_Project

the problem is: i get asked my password; until then everything is fine. But then, i't cant open my file. The case-Sensitivity is not the problem --> to this everything is rigth.

I hope, you can help me; I am a linux-Newb.

Answer Source

You have to expand your "~" inside your script.


eval var=~/Compiler/Compiler_Project
sudo $var
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download