Tag Info

Hot answers tagged


There are two errors. In short, this is the particular fix I would suggest (details follow): #!/bin/sh UBUNTU_MENUPROXY=0 /home/andrea/Programmi/Aptana_Studio_3/AptanaStudio3 Bad Hashbang Line As Shutupsquare says, your hashbang line (technical details) should start with a #! rather than just !. That is causing the first of your two error messages, and ...


Answering to the third question: of course it can be used meaningfully in the way at Bash manual clearly hints – in a trap, e. g.: $ trap 'echo ‘$BASH_COMMAND’ failed with error code $?' ERR $ fgfdjsa fgfdjsa: command not found ‘fgfdjsa’ failed with error code 127 $ cat /etc/fgfdjsa cat: /etc/fgfdjsa: No such file or directory ‘cat /etc/fgfdjsa’ failed with ...


Now that Q3 has been answered (correctly, in my opinion: BASH_COMMAND is useful in traps and hardly anywhere else), let's give Q1 and Q2 a shot. The answer to Q1 is: the correctness of your assumption is undecidable. The truth of neither of the bullet points can be established, as they ask about unspecified behaviour. By its specification, the value of ...


I was using ./script.sh to run, and the correct way is source script.sh


Should be #!/bin/bash. I also think that you should have a newline at the end of export UBUNTU_MENUPROXY=0. #!/bin/bash export UBUNTU_MENUPROXY=0 /home/andrea/Programmi/Aptana_Studio_3/AptanaStudio3


~/.profile is typically run by login shells, so sh,bash, and zsh do not process it when called normally. Invoking them by using the -l option makes them login shells, and results in sourcing of ~/.profile. zsh does not use ~/.profile, but ~/.zprofile, because of incompatibilities with other sh syntax. Most terminals have an option to run shells as login ...


Put your permanent path changes into your .profile "reopening" is starting another terminal from scratch, and it get the PATH from the system (or your) PATH setups, not from some past session.


Variables are not temporary or persistent by nature, but you can change them either temporarily or persistently. It's well explained in the tutorial EnvironmentVariables.


The easiest solution is probably to store the variable in a file. Write to a file: echo "13" > /path/to/my-variable.txt Read the first line in a file into the variable line: read -r line < /path/to/my-variable.txt

Only top voted, non community-wiki answers of a minimum length are eligible