03-01-2009
Hey thanks perderabo,
just one doubt..actually i am running a script to generate the above file.
it is generic or dynamic amd i am running it from some other location.
And i am not positioned at the parent location.
Now my question is how to run the above command from some other location
what changes are needed in the above line if i am executing this from other location?
For Eg:
i am running this script from /tmp
and the out put is like this
place1
place2
place3
checkpoint
some other text
some more text
now
place1,place2,place3
are directories under the parent directory /logs
Can you modify the above script so the inside the loop it will go into
/logs/$dir
and then do ls -l??
Thanks in advance.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, I am trying to combine 2 strings into one new string. I know there are existing threads on this topic, but I am having troubles. The variables have variables within their names which is causing me problems. Bad subsitution is the error.
The problem line is in red below.
thanks (again) to... (1 Reply)
Discussion started by: rorey_breaker
1 Replies
2. Shell Programming and Scripting
I need to do something like this:
for i in 1 2 3 4 5; do
arr=$(awk 'NR="$i" { print $2 }' file_with_5_records)
done
That is, parse a file and assign values to an array in an ascending order relative to the number of record in the file that is being processed on each loop.
Is my... (2 Replies)
Discussion started by: fiori_musicali
2 Replies
3. Shell Programming and Scripting
Hello,
I have a problem with my script whereby it does not want to loop.
The function of my script is to FTP into a server and go to each directory/volume in the array 'VOL'. The way the loop is suppose to work, is to go into the first volume, get the files of R(yesterday's date) and... (3 Replies)
Discussion started by: tuffgong2008
3 Replies
4. Shell Programming and Scripting
HI,
if a String is present in file1.txt, i want to delete that String from file2.txt.
How can i do this??
I am sure that the file1.txt is a subset of file2.txt. (2 Replies)
Discussion started by: jathin12
2 Replies
5. Shell Programming and Scripting
I have a file search_strings.txt filled with search strings which have a blank in between and look like this:
S. g. Erh.
o. J.
v. d. Chijs
g. Ehr.I would like to search the strings in the second given Textfile.txt and it shall return the column number.
Can anybody help with the correct... (3 Replies)
Discussion started by: sdf
3 Replies
6. Shell Programming and Scripting
I have a list of strings, for example:
set strLst = "file1 file2 file3 file4"
I want to log an error if some of the fields happen to begin with -, or have characters like ; : ' , ? ] { =
Which means for example setting
set ierr = 1 (2 Replies)
Discussion started by: kristinu
2 Replies
7. Shell Programming and Scripting
I wrote a simply perl that searched a file for a particualr value and if it found it, rite it and the next three lines to a file. Now I have been asked to check those next three lines for a different value and only write those lines if it finds the second value.
I was thinking the best way to... (1 Reply)
Discussion started by: billprice13
1 Replies
8. Shell Programming and Scripting
Here's my code:
awk -F '' 'NR==FNR {
if (/time/ && $5>10)
A=$2" "$3":"$4":"($5-01)
else if (/time/ && $5<01)
A=$2" "$3":"$4-01":"(59-$5)
else if (/time/ && $5<=10)
A=$2" "$3":"$4":0"($5-01)
else if (/close/) {
B=0
n1=n2;
... (2 Replies)
Discussion started by: klane
2 Replies
9. Shell Programming and Scripting
i need to add 2 string variables into a positioning array , repeatedly - in loop.
First string in $2, second to $3 then up to the desired count incrementing the "position".
Using set -- alone does not increment the count so I end up with 2 variables in the array.
How do I increment the... (7 Replies)
Discussion started by: annacreek
7 Replies
LEARN ABOUT DEBIAN
shunit2
SHUNIT2(1) SHUNIT2(1)
NAME
shunit2 - A unit test framework for shell scripts
SYNOPSIS
shunit2 unitfile
DESCRIPTION
shUnit2 is a xUnit unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to JUnit, PyUnit,
etc.. If you have ever had the desire to write a unit test for a shell script, shUnit2 can do the job.
You can either run shunit2 directly from the commandline and specify the unit file or directly source the shunit2 executable.
If you directly execute shunit2 and don't specify a unitfile shunit2 assumes a empty testfile and will return without an error message.
EXAMPLE
Simple script to test if 1 equals 1
#! /bin/sh
testEquality()
{
assertEquals 1 1
}
# load shunit2
. shunit2
Execute shUnit2 unit tests directly from the commandline
shunit2 /path/to/unit/file
OPTIONS
shunit2 does not support any commandline options at all. You can either source shunit2 to execute your unit tests or directly run shunit2
as a commandline script.
SEE ALSO
For more information see http://code.google.com/p/shunit2/ or have a look at the installed documentation in /usr/share/doc/shunit2/
AUTHOR
shunit2 was written by Kate Ward <kate.ward@forestent.com>. This manpage was written by Ulrich Dangel <mru@spamt.net>.
2.1.6 03/25/2012 SHUNIT2(1)