There are broadly speaking two distinct uses of exec:
with a command. This exits the script and executes the command. The lines following the exec statement will not be executed.
with a redirection and without a command. In this case stdin takes it input from "some_file". The lines following will be executed while stdin remains redirected.
This is irrespective of whether "some_file" exists or not..
So the answer is option 2. is used and the statements below exec will get executed whether or not the file exists...
Thanks Scrutinizer for the info on exec...
But, I still have a doubt...
To test it, I made a script file named "test2" having the following lines :
As per your explanation, "Hi" should be echoed irrespective of whether test123 exists or not. But, when I run "test2" ( with no file named "test123" in the current directory), I get the following output:
linux redhat 8.0
I am getting accustomed to using the -exec command to get around my databse.. and use it to edit and update files..! is this more apllicable than jumping from one directory to the other.. I have set up the databse so that the inode #'s are accessable and can get me from one... (0 Replies)
hai
i want know the difference between two shell scripts those are
1)
a=2004
echo $a #output------2004
exec < inputfile
while read line
do
echo $a #output-------2004
a=2005
echo $line
echo $a ... (1 Reply)
I have a ksh script that contains the following:
find /dir1/dir2 -type f -name "FILE.*" -newer /dir1/dir2/afterme.txt -exec cp /dir1/dir2/dir3 {} \;
When I run it from the cli, it runs fine. When I run it from the ksh script I get
find: missing argument to `-exec'
I also tried -exec cp... (40 Replies)
All,
I am using below shell script to output the content to outputfile.txt. What I am looking for is in addition to outputfile.txt, I want the output to be on standard output too.
exec > outputfile.txt
echo "Starting "
echo "ending" (5 Replies)
How can I use the exec command to log my korn shell session to the screen and the log file?
Currently I have this command:
$exec 1> ${LOG} 2>&1
This logs the output to the log file only. I want it to go to the screen also. Is this possible with this command?
thanks. (10 Replies)
Hi can some one explain the following command , It would really help if some can really elloborate on what is happening out here
export PATH | exec /bin/sh ./auto_approve :q
P.S: This is the first time i am using exec ,so an elloboration what does it do and what is the use of the :q will be... (1 Reply)
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)
Hi all,
Forgive me for asking for help with my first post, but I am struggling here. I've been asked to translate a bash script into a Windows script (probably batch or powershell, not sure yet), so the first step is obviously understand what the bash script is doing. But I have no experience in... (5 Replies)
Hello.
From a script, a command for a test is use :
find /home/user_install -maxdepth 1 -type f -newer /tmp/000_skel_file_deb ! -newer /tmp/000_skel_file_end -name '.bashrc' -o -name '.profile' -o -name '.gtkrc-2.0' -o -name '.i18n' -o -name '.inputrc'
Tha command... (3 Replies)
Discussion started by: jcdole
3 Replies
LEARN ABOUT DEBIAN
dh-exec-subst
DH-EXEC-SUBST(1) dh-exec DH-EXEC-SUBST(1)NAME
dh-exec-subst - Debhelper executable file substition scripts
SYNOPSIS
#! /usr/bin/dh-exec
src/libfoo-*.so.* debian/foo-plugins/usr/lib/foo/${DEB_HOST_MULTIARCH}/
DESCRIPTION
Being a sub-command of dh-exec(1), this program must not be ran directly, but through dh-exec, which automatically runs all available
sub-commands if run bare; or explicitly with dh-exec --with=subst.
It is a wrapper around the various other substitution helpers, and will pipe the input file through all the available substitution helpers.
It is up to these scripts to do the actual work.
When a helper fails to expand a variable within its input, it will leave it as-is, so that later in the pipeline it can perhaps be expanded
by another program.
SCRIPTS
dh-exec-subst-env
Substitutes any of the available, exported environment variables into its input. It does not do any kind of filtering: whatever is
available in the environment, will be available for substitution, however unsafe that may be.
dh-exec-subst-multiarch
Attempts to expand any of the variables known to dpkg-architecture(1), mostly useful for multi-arch support.
The command will query dpkg-architecture(1) directly, and does not rely on environment variables set (as the called program will
prefer already set environment variables anyway).
ENVIRONMENT
DH_EXEC_SCRIPTDIR
Indicates which directory the command-specific scripts should be sought for. If not specified, scripts will be searched for in
/usr/share/dh-exec/.
FILES
$DH_EXEC_SCRIPTDIR/dh-exec-subst-*
The various scripts for the higher-level program.
SEE ALSO debhelper(1), dh-exec(1)AUTHOR
dh-exec-subst is copyright (C) 2011-2012 by Gergely Nagy <algernon@madhouse-project.org>.
2012-05-03 DH-EXEC-SUBST(1)