03-23-2001
What is the difference between sourcing a script, running it or execing it?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I have tried both the options in small dummy scripts, but somehow i can't differentiate between the two.
find . -name H* -exec ls -l {} \;
find . -name H* | xargs ls -l
Both work the ditto way.
Any help is appreciated. (19 Replies)
Discussion started by: vibhor_agarwali
19 Replies
2. Shell Programming and Scripting
I am using a third party job management program called Autosys. the command to load a jil into the autosys database is jil < somefilename.jil
I have a directory and it in are a lot of jils. rather than type jil < somefilename.jil for every file I would like to script something do do it. if cd... (2 Replies)
Discussion started by: jayjabour
2 Replies
3. Shell Programming and Scripting
Hi, experts.
Whould anybody clear explay me difference and usage of these 3 commands (particulary in bash) :
exec
eval
source
I've tryed to read the manual pages but did not get much.
Also could not get something useful from Google search - just so much and so not exactly, that is... (3 Replies)
Discussion started by: alex_5161
3 Replies
4. Shell Programming and Scripting
Hi,
I discovered the following single-line script works very well to cp a large number of files from a source directory to a destination directory while avoiding the "argument list too large" error:
# cpmany - copy large number of files
# Takes two parameters - source dir, destination dir... (14 Replies)
Discussion started by: Tanuka
14 Replies
5. Shell Programming and Scripting
Hi, Gurus,
my script code as following:
#!/usr/bin/sh
mkdir dir1
result=`echo $?`
if ; then
echo "completed"
else
echo "wrong"
fi
When I execute it with command sh filename. , it executed successfully.
but, when I execute it with command . filename it throw out error:
-bash:ELF :... (2 Replies)
Discussion started by: ken002
2 Replies
6. Programming
I have read several docs on these on the web and looked at examples. I can't figure out the difference. In some cases you use one or the other or you combine them.
can someone help me understand this? (1 Reply)
Discussion started by: guessingo
1 Replies
7. Shell Programming and Scripting
I have the following bash script lines in a file named test.sh.
#!/bin/bash
#
# Write Date to cron.log
#
echo "Begin SSI Load $(date +%d%b%y_%T)"
#
# Get the latest rates file for processing.
#
d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1)
filename=$d
export filename... (3 Replies)
Discussion started by: ginowms
3 Replies
8. Shell Programming and Scripting
Hi,
What is the difference between the following commands
find . -type f -exec grep 'abc' {} \;
and
find . -type f | xargs grep 'abc'
Appreciate your help. (2 Replies)
Discussion started by: bobbygsk
2 Replies
9. Shell Programming and Scripting
Guru's,
I want to make a use of "exec" command in my script and want to check return code of executing script, but as you know exec command will terminate current processID and comeout and will trigger new one, i am unable to check return code of script and not able to run a scrpit after exec. ... (2 Replies)
Discussion started by: pawar.atul28
2 Replies
10. Shell Programming and Scripting
Dear all,
I would like to know the difference in executing the shell script both ways?
a.) source file.sh
b.) ./file.sh
I need to initialize some setup which is part of the file.sh. I realized that when I do the source file.sh the setup is all initlaized well. However, with the ./file.sh... (3 Replies)
Discussion started by: emily
3 Replies
LEARN ABOUT V7
confmodule
CONFMODULE(3) Library Functions Manual CONFMODULE(3)
NAME
confmodule - communicate with Debian configuration system FrontEnd.
SYNOPSIS
#!/bin/sh -e
. /usr/share/debconf/confmodule
db_version 2.0
db_capb 'backup'
CAPB=$RET
db_input 'foo/bar' || true
db_go || true
DESCRIPTION
This is a library of shell functions that eases communication with Debian's configuration management system. It can communicate with a
FrontEnd via the debconf protocol. The design is that each command in the protocol is represented by one function in this module. The func-
tionname is the same as the command, except it is prefixed with "db_" and is lower-case. Call the function and pass in any parameters you
want to follow the command. Any textual return code from the FrontEnd will be returned to you in the $RET variable, while the numeric
return code from the FrontEnd will be returned as a return code (and so those return codes must be captured or ignored).
NOTES
Once this library is loaded, any text you later output will go to standard error, rather than standard output. This is a good thing in gen-
eral, because text sent to standard output is interpreted by the FrontEnd as commands. If you do want to send a command directly to the
FrontEnd, you must output it to file descriptor 3, like this:
echo GET foo/bar >&3
The library checks to make sure it is actually speaking to a FrontEnd by examining the DEBIAN_HAS_FRONTEND variable. If it is set, a Fron-
tEnd is assumed to be running. If not, the library turns into one, and runs a copy of the script that loaded the library connected to it.
This means that if you source this library, you should do so very near to the top of your script, because everything before the sourcing of
the library may well be run again.
SEE ALSO
debconf-devel(7), dpkg-preconfigure(8), dpkg-reconfigure(8), debconf_specification in the debian-policy package
AUTHOR
Joey Hess <joeyh@debian.org>
CONFMODULE(3)