Tagged Questions
1
vote
1answer
51 views
How to assign result of sed to variable
Below is a complete copy of a demo I'm using to to figure out to get the sed command to get rid of the spaces in a persons name, and compress it down to not have spaces.
Once this is done, I want to ...
3
votes
7answers
161 views
how to share environment variables between shells like globals related to a master pid?
So, I need to share environment variables between shells, and that the changes on the variables be promptly recognized by all shells, like global variables. But they must be related to a master pid, ...
0
votes
1answer
60 views
Colon breaks the variable subsitution [closed]
I am trying to lookup some C functions so that I could debug while using strace. So I setup a bash function to look it up in firefox (or links), but the substitution falls apart with : and escaping ...
2
votes
1answer
420 views
Users home path in a bash script
I'm writing a bash-script that will be run as a cron job everyday. Very basic, I was wanting to change the wallpaper daily. I have mint-14 with mate.
The thing I'm getting caught up on right now ...
-1
votes
3answers
487 views
How to run a shell script with export command in crontab
I have a shell script that exports values of variables when executed. The same values will be used in another script.
How to run this script(test.sh) in cron.
#!/bin/sh
export I="10"
echo $I
I will ...
1
vote
1answer
154 views
Environment auto-install script
When I work, I often have to switch computers or virtual machines which means that every time I switch, I have to set up my (Linux) environment again.
Is there a tool (in contrast to a simple bash ...
0
votes
1answer
196 views
difficalty to save traceroute output in shell variable?
I need to filter and store traceroute output in shell variable (array). But I am getting some unusual output.
As I try to explain in following lines.
My present directory is temp, having some ...
2
votes
2answers
452 views
Sharing Variables across sub shell scripts
I have a Main shell that runs a profile, The profile contains some variables such as Count. When I call the main shell, it loads the profile and then call another shell script. I want that inner shell ...
2
votes
1answer
1k views
How can I set environment variable permanently through shell script?
Let's say I have a script:
#!/bin/bash
echo $1
if [[ ! $1 ]];then
echo "True"
fi
export ABC="/home/aashish"
ABC is not available after the execution of this script. How can I make that variable ...
3
votes
2answers
691 views
sourcing a file inside a script
I'd like to source a file inside a tcsh script. In code:
#!/bin/tcsh
unsetenv LD_LIBRARY_PATH
source $1
echo $LD_LIBRARY_PATH > temp_file
The expected result: The environment variable set ...
1
vote
3answers
336 views
Accessing bash [internal] brace expansion iteration number/variable
Question:
Is it possible to access which number of a bash iteration is currently being processed?
Psuedo-Command
mv {1..5}.something.{1..5} $x1.$x2.something
Note: This is a logical ...
0
votes
1answer
230 views
Shell script executing in the terminal but not from shell script file [duplicate]
Possible Duplicate:
How can I make variables “exported” in a bash script stick around?
I have a problem with executing script from file. When I type in command line
...
0
votes
2answers
270 views
Checking if PATH contains $HOME/mydir and adding it if not (all in a script) [duplicate]
Possible Duplicate:
keep duplicates out of $PATH on source
I am not an expert with Unix scripting. Some of my scripts are located in $HOME/mydir. Unfortunately, they are not accessible from ...
5
votes
2answers
2k views
Set Variable Environment Variables in bash (or other)
I want my script to read a file containing key/value pairs of environment variables to set, and then to set them.
So far, I have this:
#!/bin/bash
cat $1 | while read kv
do
key=${kv%=*}
...
5
votes
3answers
6k views
How to set global environment variables at boot through a script, and have them available for an application that runs before login?
I have a service that runs at boot, and in that service it calls a bash script in the background that exports some environment variables. The problem I'm having is that those environment variables ...