I'm new to scripting and I need help with a bourn shell script. What i'm trying to do is a test condition where "if the time is within 2 hours, it's true" and so on.
The time is in the following format
DATE=`/bin/date +"%Y%m%d%H%S"`
for example, 20060907152000.
So, what the script first... (9 Replies)
What would be the best way or method to determine or test for the shell interpreter at the beginning of a script in the event one shell is not available?
If I use the following:
#!/bin/bash
and /bin/bash is not available, then use I'd like to use /bin/ksh if it is available.
#!/bin/ksh (8 Replies)
I need clarification in -a test.
If say, in test -a left expression is not present but the right expression is present, do the shell will consider the left expression true and evaluate the right expression?
For example:
if ]
then
rm -f ${file}
fi
Is this test condition... (7 Replies)
Hi
I am having a question where I have to
1) Identify the number of files in a directory with a specific format
and if the count is >1 we need to concatenate those two files into one file and remember that in the second file the header should not be copied. it should be form first file.... (4 Replies)
I want to test connectivity between different servers with my server using information as IP and port only.
I have Name,IP List and port in one file. Please help how i can test connectivity is successful or not?
File format will be:
Name1,127.0.0.1,80
Name2,127.0.0.2,8080
Output could be ... (1 Reply)
Hi,
I am trying to write a small script that validates if there exist files that start with a pattern in a given directory. Below is the piece of my script:
#!/usr/bin/ksh
BTFDIR=/opt/ships/temp
if
then
echo 'found'
else
echo 'not found'
fi
When I run this... (2 Replies)
Hi,
Is there any simple way to get/identify the variables that are used in a file and print those variable names. If I have something like this in a file,
/$var/temp_dir/${var2}${var3}.log
I want to display the variables 'var', 'var2' and 'var3' from that file. I tried something like... (6 Replies)
Dears ,
kindly I wanna do test for one KSH script to know how is it working , the problem that I'm facing is whenever put "sh -x ./my_script.sh"
the output seems very long & although I tried to to redirect it to files as it shown , but it failed :eek: :-
sh -x ./my_script.sh >... (2 Replies)
Hi,
I am running my pipeline and capturing all stout from multiple programs to a .txt file. I want to go into that .txt file and search for specific lines, and finally print those lines in a second .txt file.
I can do this using grep, awk, or sed for each line, but have not been able to get... (2 Replies)