12-01-2010
Would there be anyway to do this without using temporary files?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
how to use if-loop in bourne shell with multiple conditions like follows
if
then
commands
fi
it gives me an error
test: ] missing
then i put
if ]
it gives me an error
[[ not found
kindly i need the syntex for the bourne shell (5 Replies)
Discussion started by: ahmad.diab
5 Replies
2. Shell Programming and Scripting
Hi,
I am stuck while developing a shell sub-routine which checks the log file for "success" or "failure". The subroutine reads the log file and checks for key word "success", if found it set the variable (found=1). It returns success or failure based on this variable.
My problem is, I can... (2 Replies)
Discussion started by: cjjoy
2 Replies
3. Shell Programming and Scripting
If I set a variable within a while-read loop, sometimes it's local to the loop, sometimes it's global, depending on how the loop is set up. I'm testing this on a Debian Lenny system using both bash and dash with the same results.
For example:
# Pipe command into while-read loop
count=
ls -1... (2 Replies)
Discussion started by: mjd_tech
2 Replies
4. Shell Programming and Scripting
hi all,
i'm using the following script,
Status=1
Function_do ()
{
while read line;
do
if ; then
#echo $line
if ; then
Status=0
echo " LINKINK ERROR "
fi
fi
done < ldd.log
}
Function_do (4 Replies)
Discussion started by: vij_krr
4 Replies
5. Shell Programming and Scripting
Hello Everyone....
I am trying to print a number sequence in following format using for loop.
I am using a bourne shell. I tried following for loop condition but it is bash syntax.
for (( i=0; i<=5; i++ ))
It is giving syntax error.
Kindly help with the syntax of "for"... (7 Replies)
Discussion started by: EmbedUX
7 Replies
6. Shell Programming and Scripting
hi,
I am trying to assign a value through 'read' and all works well until I have a space in the in putted value, for the life of me I cant figure out how to escape this. :wall:
Any ideas?
#!/bin/sh
ask_question() {
question_text="${1}";
question_answer="";
... (2 Replies)
Discussion started by: redback
2 Replies
7. Shell Programming and Scripting
for (( i=1; i<=3; i++ )); do
for (( j=1; j<=3; j++ )); do
for (( k=1; k<=3; k++ )); do
echo $i$j$k
done
done
done
Will the above code work on a BOURNE shell?
As far as my understanding is, if I am writing the above code in a file..say lol.sh and then running it through the terminal using... (7 Replies)
Discussion started by: navienavnav
7 Replies
8. Shell Programming and Scripting
Hello,
I am trying to write a shell script that maintains the health of the passwd file. The goal is to check for duplicate usernames, UID's etc. I am able to find and sort out the UID and login names via awk (which I would like to use), but I can't figure out how to save the record field into a... (1 Reply)
Discussion started by: Learn4Life
1 Replies
9. Shell Programming and Scripting
I have a loop with cases
I am working on Bourne shell
for file in *.${Today}*.csv *.${Today}*.txt\
do
case ${file} in
sun_detail)
do something
;;
sum)
do something
;;
mod)
do something
;;
*)
do something
;; (5 Replies)
Discussion started by: digioleg54
5 Replies
10. UNIX for Beginners Questions & Answers
Cope sample1: test.sh
i=0
echo " Outside loop i = $i "
while
do
i=$(( $i + 1))
echo "Inside loop i = $i "
done
echo " Out of loop i is : $i "
When run output :
Outside loop i = 0
Inside loop i = 1
Inside loop i = 2
Inside loop i = 3
Inside loop i = 4
Inside loop i = 5
Inside... (8 Replies)
Discussion started by: Adarshreddy01
8 Replies
LEARN ABOUT DEBIAN
strmregisteredfiles
sttmpfiles(3) ShapeTools Toolkit Library sttmpfiles(3)
NAME
stTmpFile, stRegisterFile, stUnRegisterFile, stRmRegisteredFiles - temporary files handling
SYNOPSIS
#include <config.h>
#include <sttk.h>
char*stTmpFile (char *path);
voidstRegisterFile (char *fileName);
voidstUnRegisterFile (char *fileName);
voidstRmRegisteredFiles (void);
DESCRIPTION
stTmpFile creates a unique filename for a temporary file, registers it (see stRegisterFile below), and returns it. The return value
resides in static memory and will be overwritten on the next call of stTmpFile. The temporary file is located in the /tmp directory.
stRegisterFile adds the given fileName to an internal static list of file names. This list helps to keep track of the names of all tempo-
rary files to be deleted until the end of the program execution. On abnormal program termination (signal), the termination handler may call
stRmRegisteredFiles to delete all registered files. This avoids bogus temporary files to survive abnormal program termination.
stUnRegisterFile removes fileName from the internal list of file names. It should be called when the corresponding file was removed due to
the regular control flow.
stRmRegisteredFiles removes all files named in the internal list set up by stTmpFile and stRegisterFile and clears the list. Bogus entries
in the list (names without a correponding file) are ignored. Invoking stCatchSigs(3) causes stRmRegisteredFiles to be called on occurence
of the signals SIGQUIT, SIGFPE, SIGBUS, SIGSEGV, and SIGTERM. stCleanup(3) also calls stRmRegisteredFiles.
SEE ALSO
stCatchSigs(3), stCleanup(3)
LIMITS
The maximum number of temporary files to be registered is 16.
sttk-1.7 Thu Jun 24 17:43:36 1993 sttmpfiles(3)