Tagged Questions
0
votes
1answer
37 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
187 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
vote
1answer
109 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
153 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
292 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
871 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
450 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
270 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
180 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
...
4
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%=*}
...
4
votes
3answers
4k 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 ...
10
votes
4answers
535 views
keep duplicates out of $PATH on source
I have the following code that's source-d by my .shellrc
PATH="${PATH}:${HOME}/perl5/bin"
PATH="${PATH}:${HOME}/.bin"
export PATH
but if I make changes to other code and then source this file, my ...
23
votes
2answers
1k views
$VAR vs ${VAR} and to quote or not to quote
I can write
VAR=$VAR1
VAR=${VAR1}
VAR="$VAR1"
VAR="${VAR1}"
the end result to me all seems about the same. Why should I write one or the other? are any of these not portable/POSIX?