TheFrenchPlays Hd Micraftn TheFrenchPlays Hd Micraftn - 4 months ago 9
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.


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


eval var=~/Compiler/Compiler_Project
sudo $var