I always worry about marking relative references in scripts. If something doesn't exist, a cd will just refuse and unless you carefully manage errors, then you could end up damaging important files. Consider:-
This would (probably in a bad way anyway) remove a sensitive remote host address from /etc/hosts in preparation for a DR test to reduce the risk of actually sending data to the bank. Of course, if you run this and /disaster does not exist then you empty /etc, which could be a little awkward, to say the least.
Could it be a better plan to have a variable made of several others, such as:
You would still have to check that these exist, of course, but it reduces the risk of a typing error and one action compounding on another.
Maybe I'm paranoid, but unless you consider every possible action and error, then it's a dangerous game. I've been bitten in the past, so I can't claim perfection, just learning from experience.
I hope that this helps,
Robin
Liverpool/Blackburn
UK
Gents,
Please i need your help.
Using the file2.txt i will like to replace values in file3.txt.
Example in file 2 column 1 is the value to find in file3.txt and replace with value in colunm2 (file2.txt).
Example
file2.txt
21 1209
22 1210file3.txt
SCI TB Timestamp Local : 8/30/17... (2 Replies)
I have a variable and assigned the following values
***XYZ_201519_20150929140642_20150929140644_211_0_0_211
I need to read this variable from backward and stop read when I get first underscore (_)
In this scenario I should get 211
Thanks
Kris (3 Replies)
Gents,
Please can you help me.
I need to update file1 using file2 values
file1
S 44519.00 49349.00 1V1 0.0 0 0.0 0.0 0.0 0.0289091513
S 44513.00 48581.00 1V1 0.0 0 0.0 0.0 0.0 0.0289094319
S 44511.00 48605.00 1V1 0.0 0 0.0... (1 Reply)
Hey guy's....
I new here,
But im working on a school project, and I am not really good at programming. In fact, this is the only programming class that I need because programming is not what I am majoring in.
But I have everything done in this shell script except for this last part.....
... (9 Replies)
All,
I have a log file containing lots of data now i want to extract all text between block below(names) without the title or end pattern but only names,
++++START++++
SCOTT TIGER
HENRY PAUL
JARED OTIENO
OMOLLO JA NIGERIA
++++END++++
the names i want to return and store in a variable in... (1 Reply)
Hi all,
Hereby wish to have your advise for below:
Main concept is
I intend to get current directory of my script file.
This script file will be copied to /etc/init.d.
A string in this copy will be replaced with current directory value.
Below is original script file:
... (6 Replies)
I'm trying to replace path which is part of variable inside script file:
FROM:
ABC_HOME=$ABC_ROOT/abc/1.0
TO:
ABC_HOME=$ABC_ROOT/abc/1.5
I'm using this:
perl -pi -e 's\ABC_HOME=$ABC_ROOT/abc/1.0\ABC_HOME=$ABC_ROOT/abc/1.5\g' /apps/scripts/test.sh
This command is not working because... (2 Replies)
I may not being doing this description justice, but I'll give it a try.
I created a mailx script; there will be several messages using the same script where the only difference is the content. So I figured I'd make the content of the message a variable retrieved from a separate file. I have five... (5 Replies)
Hi,
Here is the output of lpstat. I would like to read value of Queue which is(abxxxxb1)and status that is DOWN in first line. i dont care what is in second line. any one can help me.thanks
Queue Dev Status Job Files User PP % Blks Cp Rnk
------- ----- ---------... (5 Replies)
hi!
i have a file consisting of the following lines:
(BTW, = space)
.
.
.
12ME_T1mapping_flip30bshortf
13DCE_whole_brainbshortf
13DCE_3Dbshortf
.
.
.
the list of scans starts at 1 and goes on sometimes up to 60 scans. i would like to change only the lines that contain 'whole' to... (2 Replies)