Sponsored Content
Full Discussion: Help with script
Top Forums Shell Programming and Scripting Help with script Post 302190039 by Movomito on Monday 28th of April 2008 01:28:17 PM
Old 04-28-2008
Help with script

I have created the following script.

#!/bin/bash
#works list is any list that you give it, but it was designed to be used with the entire image volume list.
#for this script to have the most effect please run mobooksfiles/find-remove-empty-ebooks.sh befor running this.
if [ ! $2 ]; then
echo missing arguments\(s\)
echo rsync-from-file.sh \<works-list\> \<target-read\>
exit 1
fi

TARGET=$2
WORKLIST=/Users/tbrc/scripts/works2eBooks/$1
NOTEMPTY=/Users/tbrc/scripts/works2eBooks/mobooksfiles/notempty.txt
RESULT=/Users/tbrc/scripts/works2eBooks/mobooksfiles/result.txt

exec 3<&0
exec 0<$WORKLIST
while read line
do
cd $TARGET
find ./$line -type d \! \( -name "image*" -empty \) | awk -F'/' '{a[$2]++; if ( a[$2]==1 ) print "/"$2}' |
while read dir;
do
find .$dir -type d -name 'e*' | grep . && continue
echo "$dir" >$RESULT
done
done
exec 0<&3

#if you get rid of this line and the # before java below eBooks will be generated for the files found to have none from the above script
cd /Users/tbrc/scripts/works2eBooks
java -classpath pdflib.jar:. works2eBooks $TARGET $RESULT

exit 0




There are a few things that i dont understand that seem to be happening. The first is when i remove my >RESULT it outputs all of the files to the screen like this

./W2/eBooks/
./W3/eBooks/
./W4/eBooks/
/W5
but when i add >RESULT I still get this on the screen
./W2/eBooks/
./W3/eBooks/
./W4/eBooks/
and this to RESULT
/W5

Why is this happening? (I do like that it happens but am not sure why)

and issue number 2. It was outputting all of the directories that didn't have ebooks to RESULT but after some tinkering seems to only be outputting the first directory that it finds not to have eBooks to result.

my script then generates an ebook for it. So if i run it again it finds the next and so on but i obviously want it to output all of them at once. Any help would be great. And any suggestions on how to make it run even faster aside from what i have asked for would also be great.

Thanks
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies

2. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

3. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

4. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA_publish.sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies

5. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
AUGPARSE(1)							      Augeas							       AUGPARSE(1)

NAME
augparse - execute an Augeas module SYNOPSIS
augparse [OPTIONS] MODULE DESCRIPTION
Execute an Augeas module, most commonly to evaluate the tests it contains. OPTIONS
-I DIR Add DIR to the module loadpath. Can be given multiple times. The directories set here are searched before any directories specified in the AUGEAS_LENS_LIB environment variable, and before the default directory /usr/share/augeas/lenses. --nostdinc Do not search any of the default directories for modules. When this option is set, only directories specified explicitly with -I or specified in AUGEAS_LENS_LIB will be searched for modules. --notypecheck Do not perform lens type checks. Only use this option during lens development and make sure you typecheck lenses when you are done developing - you should never use a lens that hasn't been typechecked. This option is sometimes useful when you are working on unit tests for a lens to speed up the time it takes to repeatedly run and fix tests. --version Print version information and exit. -h Display this help and exit EXAMPLES
To run the tests in lenses/tests/test_foo.aug and use modules from the directory lenses, run augparse -I lenses lenses/tests/test_foo.aug TESTS
Tests can appear as top-level forms anywhere in a module. Generally, the tests for a module lenses/foo.aug are kept in a separate file, usually in lenses/tests/test_foo.aug. There are two different kinds of tests that Augeas can run: get and put tests. The syntax for get tests is test LENS get STRING = RESULT which applies the get direction of the lens LENS to STRING and compares it with the given RESULT. RESULT can either be a tree literal, the symbol ? to print the result of applying LENS to STRING, or the symbol * to indicate that the test should produce an exception. The syntax for put tests is test LENS put STRING after COMMANDS = RESULT which first applies the get direction of the lens LENS to STRING, then applies the given COMMANDS to the resulting tree, and finally transforms the modified tree back to a string using the put direction of LENS. The resulting string is then compared to RESULT, which can be a string, the symbol ? to print the result of applying LENS to STRING, or the symbol * to indicate that the test should produce an exception. SEE ALSO
Augeas project homepage <http://www.augeas.net/> augtool Augeas 0.9.0 2011-11-29 AUGPARSE(1)
All times are GMT -4. The time now is 07:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy