New answers tagged

0

You should invoke the script as source bin/postactivate A process has environment variables. Let us assume your shell has a process id of 1003. You invoke sudo sh ./bin/postactivate. PID 1003 forks to create a new process, say 1108. process 1108 calls exec to change itself into sudo. sudo then changes itself into sh to process your script. So PID 1108 sets ...


0

If you want to ensure a script has a clean environment you can alter the shebang line like this little example illustrates: #!/usr/bin/env -S -i bash env which displays its environment like this PWD=/home/myuser/mydir SHLVL=1 _=/usr/bin/env Here, we run the bash shell through env which takes an -i argument that instructs it to clean the environment. The -...


2

We face this kind of issue while using the packages is not from default RHEL. Cron may not run with the same environment as we run in the foreground. we may be required to give full path of commands. locate the path of sapcontrol by using the below command. whereis sapcontrol it may be /bin/sapcontrol or /usr/local/bin/sapcontrol update the obtained ...


1

This method handles the starting/ending path delimiter: echo $PATH | sed 's/:/\n/g' | grep -v <path description> | xargs | tr ' ' ':' Explanation: echo the $PATH var into sed which replaces ':' with newlines grep the output and remove the lines matching our query xargs the output to replace newlines with spaces tr the output to replace ...


3

As stated in Arch Linux wiki Locale,LC_ALL: troubleshooting: LC_ALL is the only LC_* variable which cannot be set in locale.conf files: it is meant to be used only for testing or troubleshooting purposes, for example in /etc/profile. In locale.conf — Configuration file for locale settings, at systemd documentation is stated that: Note that LC_ALL may not ...


0

For me the most convenient and flexible approach was a mixture of an alias and a script: create script with arbitrary logic Here I create a script that changes to a directory and activates the appropriate python environment. The scripts location is exmplary in /path/to/workon_myproj.sh. #!/usr/bin/env bash cd $HOME/workspace/myproj source .venv/bin/...


0

Putting echo $LC_ip in your script would only print the value of $LC_ip on the local machine's environment. I believe the easiest way to fetch the value from the remote machine is to print it to stdout on the remote machine. To do that I think you might be able to modify your arguments1.sh: #!/bin/bash LC_ip=$(http://v6.ident.me) echo $LC_ip But that ...


0

Single quote within a double quote worked for me. Might help someone test="'h/#ello'"


0

The problem is that under Plasma Wayland the .profile or .bashrc are not read any more. Wayland Gnome run into that issue too and later manually source .profile When using system.d the way to go is to create a file under `~.conf/environemnt.d/.conf and include KEY=value pairs. Any will do, extension has to be .conf. system.d will read those entries and ...


0

You can put global environment variables in /etc/environment. They are loaded when a program is run by the crontab. Ex : env | grep ORACLE_HOME >> /etc/environment service crontab restart The drawback is that it is not restricted to a single user. Tested under CentOS7


0

spawn /bin/bash -c ". ./source_script.sh && ./exec_script.sh"


0

The .bashrc file is sourced only when starting a new shell session, and only in so-called interactive mode. I'm not sure what you mean by "the menu", but it probably only runs the gvim as a command, it doesn't start a new session. If you are using the Application Launcher (activated by pressing "windows" key or clicking on icon in left-bottom corner), you ...


0

Adding to another answer, I find it's helpful to define the following alias: alias refreshenv="bash;exit" Doing this will ensure that the parent bash instance will be killed as soon as you exit the child bash instance and so on. Avoids you having to type exit multiple times, as you'd have to do with just typing bash.


Top 50 recent answers are included