0

I have to run a bash script GoogleDrive.sh that changes the environment variables of ~/.profile file. In terminal emulator source GoogleDrive.sh works fine, but when I put this command in desktop shortcut it says source is not a command and it is not recognized. How can I run GoogleDrive.sh file with the source command without opening new terminal session? The file GoogleDrive.sh looks like this:

#!/bin/bash

if [ $GOOGLE_DRIVE_ON -eq 0 ]; then
  google-drive-ocamlfuse ~/GoogleDrive
  export GOOGLE_DRIVE_ON=1
  dolphin ~/GoogleDrive
else
  fusermount -u ~/GoogleDrive
  export GOOGLE_DRIVE_ON=0
fi

The global variable in my .profile file is GOOGLE_DRIVE_ON.

The source command runs fine from the terminal emulator, but from a desktop shortcut it is not recognizable.

I use Kali linux.

1
  • 2
    I don't understand. Why don't you just have these in your ~/.profile so they're read when you log in? Or are you saying they are in your ~/.profile but they are not used by your graphical shell? What operating system are you using? If Linux with a GUI, which Linux, which desktop manager and which login manager are you using? Also what is a "shortcut"? Do you mean a .desktop file? – terdon Jul 15 '20 at 11:57
1

source isn't a file on UNIX machine. source is a built-in shell command. such as export or shopt.
In deept, in programming world,exec function run a file in your disk. it can't run a built-in shell command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.