In Shell Script Does Second Command Wait For First Command To Complete
Hi All,
I have a question related to Shell scripting. In my shell script, I have following two commands in sequence:
The first command is operating on large number of data like 20k. Will it be possible that the second command is executed and rename the temporary file to original file name before the first operation is completed.
Did not use 'wait' yet.
How I understand by now the wait works only for child processes, started background.
Is there any other way to watch completion of any, not related process (at least, a process, owned by the same user?)
I need to start a background process, witch will be waiting... (2 Replies)
i want to search in the current directory all the files that contain one word for example "hello"
i want to achieve it with the grep command but not with the grep * (2 Replies)
When running a command using the >(cmd) syntax in bash how do you wait for the command to complete before moving on in your script?
Here is a simple example:
zcat largefile.gz | tee >(wc && echo “HELLO”) > /dev/null
# I tried wait, here but it doesn't wait for the process in the subshell.... (8 Replies)
HI,
I have a strange problem. A shell script that runs fine on solaris. when i ported to linux, it started hanging.
here is the core of the script
CFG_FILE=tab25.cfg
sort -t "!" -k 2 ${CFG_FILE} | egrep -v "^#|^$" | while IFS="!" read a b c
do
#echo "jobs output"
#jobs
#echo "jobs... (13 Replies)
Hi,
When I query using ps -ef, the complete command is not displayed and is truncated.
Can you please tell me a method to resolve this ?
I have tried the below.
ps -ef | cat
ps -ef | grep imp >/tmp/t1.txt
/usr/ucb/ps -auxw
pargs <pid>
/usr/ucb/ps -aefyl | grep imp
Thanks (11 Replies)
I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found"
My code is as follows:
--------------------------
#!/bin/sh
user="test"
DIR="/bldtmp/"$user
VIEW="test.view1"
echo "TMPDIR before export... (4 Replies)
I have the following ksh script:
sqlplus usr1/pw1@DB1 @$DIR/a.sql $1 &
sqlplus usr2/pw2@DB2 @$DIR/b.sql $1 &
wait
echo "Done!"
Where $DIR is a variable with the absolute path where a.sql and b.sql are.
For some time, I've been running this script daily and it works fine. The intentions is... (5 Replies)
Let's say I start process A.sh, then start process B.sh. I call both of them in my C.sh
How can I make sure that B starts its execution only after A.sh finishes.
I have to do this in loop.Execution time of A.sh may vary everytime.
It is a parameterized script. (17 Replies)
Hello,
im having bash script with
while ***
command1 &&
command2 &&
command3 &&
done
i want to ask how i can prevent overloading server, by waiting untill all commands complete? any low resources intensive command like "wait" - i dont know if exist? (2 Replies)
Hi everyone
I have a problem with my script
If I try directly this command
/usr/bin/nice -n 19 mysqldump -u root --password="******" wiki_schneider -c | nice -n 19 gzip -9 > /point_de_montage/$(date '+%Y%m%d')-wiki-db.sql.gz
It works
But if I simply add this command in a script and... (8 Replies)
Discussion started by: picemma
8 Replies
LEARN ABOUT DEBIAN
tempfile
TEMPFILE(1) General Commands Manual TEMPFILE(1)NAME
tempfile - create a temporary file in a safe manner
SYNOPSIS
tempfile [-d DIR] [-p STRING] [-s STRING] [-m MODE] [-n FILE] [--directory=DIR] [--prefix=STRING] [--suffix=STRING] [--mode=MODE]
[--name=FILE] [--help] [--version]
DESCRIPTION
tempfile creates a temporary file in a safe manner. It uses tempnam(3) to choose the name and opens it with O_RDWR | O_CREAT | O_EXCL.
The filename is printed on standard output. See tempnam(3) for the actual steps involved in directory selection.
The directory in which to create the file might be searched for in this order (but refer to tempnam(3) for authoritative answers):
a) In case the environment variable TMPDIR exists and contains the name of an appropriate directory, that is used.
b) Otherwise, if the --directory argument is specified and appropriate, it is used.
c) Otherwise, P_tmpdir (as defined in <stdio.h>) is used when appropriate.
d) Finally an implementation-defined directory (/tmp) may be used.
OPTIONS -d, --directory DIR
Place the file in DIR.
-m, --mode MODE
Open the file with MODE instead of 0600.
-n, --name FILE
Use FILE for the name instead of tempnam(3). The options -d, -p, and -s are ignored if this option is given.
-p, --prefix STRING
Use up to five letters of STRING to generate the name.
-s, --suffix STRING
Generate the file with STRING as the suffix.
--help Print a usage message on standard output and exit successfully.
--version
Print version information on standard output and exit successfully.
RETURN VALUES
An exit status of 0 means the temporary file was created successfully. Any other exit status indicates an error.
BUGS
Exclusive creation is not guaranteed when creating files on NFS partitions. tempfile cannot make temporary directories. tempfile is dep-
recated; you should use mktemp(1) instead.
EXAMPLE
#!/bin/sh
#[...]
t=$(tempfile) || exit
trap "rm -f -- '$t'" EXIT
#[...]
rm -f -- "$t"
trap - EXIT
exit
SEE ALSO tempnam(3), mktemp(1)Debian 27 Jun 2012 TEMPFILE(1)