Programming :: Bash - Automatically Build A Set Of Packages And Redirect Output Into Logs - Failed Make Should Return A Non-zero Value

Jun 27, 2011

I have a set of bash scripts that I'm running that automatically build a set of packages for me and redirect their output into logs. Basically, I have a bunch of lines that are something like this: ${CONFIGURE_DIR}/configure &> ${LOG_DIR}/log or cd ${CONFIGURE_DIR} && make &> ${LOG_DIR}/log, etc.

This is supposed to make the entire process silent. However, sometimes with some packages some output leaks to my console (either stdout or stderr). I'm thinking that maybe the configure scripts/make are executing commands within new shell instances that don't inherit my redirect, or something to that effect.

Another reason for thinking this is that in another part of my script I detect errors when running make by testing with "if [ $? -ne 0 ]", and if the redirect leaks to my console and also the leaked output indicates that the build failed ("make: Error" and so on), then my $? test fails (i.e., it thinks that $? == 0, whereas a failed make should return a non-zero value). It's as if my original script can't "see" the results from child commands executed from later scripts.

View 1 Replies


ADVERTISEMENT

Programming :: Bash Ambiguous Redirect - Redirect One Command Output Which Will Be Treat As A Content Of File For Another Command?

Mar 9, 2011

I am trying to grep multiple numbers from file, grep does have the -f option for that.

Code: grep -f <`seq 500 520` /etc/passwd I know this could be done with

Code: for i in `seq 500 520`; do grep "$i" /etc/passwd; done But my question is fare more behind this example. It is possible to redirect one command output which will be treat as a content of file for another command ?

View 2 Replies View Related

Programming :: Bash - Redirect All Subsequent Std Output To File?

Feb 11, 2010

I have got a script with an outer and inner loop. The inner loop issues loads of echo's which need to be redirected to a log file determined by the outer loop. The obvious solution is to redirect every echo to >$LOG and set LOG in the outer loop.

Code:

for f in $FILES ; do
LOG=<logfile>
for l in $LINES ; do

[code]....

it is possible to map stdout to $LOG in the outer loop without having to redirect every subsequent individual command output?

View 4 Replies View Related

Programming :: Make A Automated Build-script With Bash?

Apr 14, 2010

I'm trying to make a automated build-script with bash but i keep getting different errors that I can't seem to figure out. Could anyone please tell me what's wrong with this package of build-scripts? I'm posting the main build-script and attaching the rest of the scripts in a compressed form. The errors mainly comes from the scripts in "/first_installation/usr/share/siem-live/init"

[Code]...

View 2 Replies View Related

Programming :: Make An Automated Build-script With Bash

Apr 14, 2010

I'm trying to make a automated build-script with bash but I keep getting different errors that I cant't seem to solve for various reasons. what's wrong with this build-script? I'm posing the main build-script and attaching the rest of the scripts in a compressed form. Buld-script link: [URL]

[Code]....

View 3 Replies View Related

Ubuntu :: Capture And Redirect The Output Using Bash?

Jun 3, 2010

if I'm posting to the wrong forum. Be so kind to tell me where to better ask this question, as I'm really not finding the right words to google for.So, I have a shell application (fdb) which is a Flash debugger. I want to run it using bash script, capture it's output and pass it the commands (it can read from STDIN). The reason I want to do so is that Flash Builder (the IDE for Flash development) is plain stupid when it comes to compilation, and it won't allow me to compile any file in the project... so, I found out that I can make Eclipse to run an external tool. This external tool is my *.sh file whichches the compiler, and then it launches the debugger.The Eclipse console can display the compilation results, or errors. When I run the debugger it can even pass the input from Eclipse console to the debugger, however, the output from the debugger isn't shown.

View 1 Replies View Related

Programming :: How To Redirect ALL Output To (log) File?

Aug 6, 2010

I am again struggling to make a script work, but hey, it is fun, I am learning new things. I discovered the set -x option which was, for me, like the second coming. Still, what I am not able to do is redirect ALL output to a (log) file, including what is produced by the -x setting. Let's assume a very simple script:
Code: #!/bin/bash
set -x
source="/home/atelier/Bureau/"
ls -la $source and I am running it as . test.sh >> /var/log/test.rmcb.log

The result of ls goes inded into the log file, but the rest still shows on the console where I am running the script: Code: ++ source=/home/atelier/Bureau/
++ ls --color=auto -la /home/atelier/Bureau/ Is there a way to redirect EVERYTHING to the log file ?

View 3 Replies View Related

Programming :: Cannot Capture SCP Progress Bar In Output Redirect

Oct 31, 2010

I would really like to capture the output of scp and my file's progress. Scp updates the transfer rate every 1 second, and I will like to save the transfer rate at every update. So for example, if the file transfer takes 30 seconds, I would like 30 reports of the transfer rate.

The output looks like:
Code:
file.dat 1% 3664KB 938.5KB/s 05:48

Whenever I try a simple redirect like:
Code:
scp file.dat 192.168.1.100:~/ &> output
... it does not save the rate at every update, it only shows the final rate.

If I try using typescript by starting "script" ... it's the same deal.

View 7 Replies View Related

Programming :: Redirect Output To Files Using Shell?

May 21, 2011

I have a huge database of students, I would like extract these data and write to individual file for each students.

I am running a loop in shell program (.sh file), the output of each run in the loop need to redirected to a file with variable name.

I tried the following line, but it did not work, where BodyMsg is the data and Rollno is the students roll number.

echo $BodyMsg > $RolNo".html"

View 5 Replies View Related

Programming :: Redirect Output To Remote Server Via Ssh?

May 18, 2009

I need to output of the script to the remote server via redirect. I created a simple script for your reference.Quote:

#!/bin/bash
W=`/usr/bin/w`
FREE=`/usr/bin/free`

[code]...

View 4 Replies View Related

Programming :: Shell Script - Redirect Output To File

Sep 6, 2010

I did a select on my db and now I need that this if consult return true for me salve the columns information in file. How I do this in Shell?!

View 3 Replies View Related

Programming :: BASH Read File Once Then Return To Top?

Aug 8, 2010

I have a script that reads part of a line, delimited between the first and second intended part by a colon. Then it "chops" the part after the colon, which are words offset by commas (counting them beforehand so as to catch every word in the string's second part), like this:

Code:

"COLORS.JPG:red,orange,yellow,green,"
(Returning)
red

[code]....

single script that parses/breaks both parts of a line like this "COLORS.JPG:red,orange,yellow,green;blue,indigo,violet," so that the two parts, separated into single words (or two and three words, sometimes with spaces) can be used as single-line annotations and written to JPEG files using Exiv2. So far, I haven't been able to come up with a script that does this without one part of the total string(usually that part after the colon) becoming the first word in the second array. In other words, I look for this:

KEYWORDS:

[ ]red
[ ]orange
[ ]yellow

[code]....

Or vice-versa (ie, the second array winds up as a single-line "member" of the first). I think it's because I'm using a single while read loop to read the text file in which the filenames and substrings happen to be. If there's some way of reading a file once and going back to the beginning to read it again in another while loop, I haven't found it.

View 14 Replies View Related

Programming :: Redirect The Output To Multiple Files Without Displaying It To The Screen?

Oct 26, 2010

To redirect standard output to multiple files:

Code:

echo Test | tee file1 file2

My problem is that the word "Test" still displays to the screen? I want same effect as:

Code:

echo Test > file1

but with multiple file redirection.

View 3 Replies View Related

Programming :: How To Redirect Inside Bash Script

Oct 23, 2010

I want to do the following redirectin inside a bash script :

1. all the stdout will be redirected to a /tmp/log

2. all the errors will go to the stderr and also to the /tmp/log.

The following inside a bash script is not working, WHY and HOW to do it:

Rest of the bash script.

View 4 Replies View Related

Ubuntu :: Make A Automated Build-script With Bash

Apr 13, 2010

I'm trying to make a automated build-script with bash but i keep getting different errors.

Code:

#!/bin/bash
gpg --import /home/epm/first_installation/config_chroot_sources_local.gpg
gpg --import /home/epm/first_installation/config_chroot_sources_packages-inl-fr.gpg

[code]....

View 5 Replies View Related

General :: Make Bash And It's Apps Automatically Resize?

May 29, 2011

I'm working in Debian, and I've noticed that when I resize my PuTTY window, the console inside isn't resizing to the new dimentions, so things like nano are running at 80xwhatever instead of the more useful 130xsomething that I've offered it.

View 2 Replies View Related

General :: Make A Bash Script That Automatically Delete The Home Folders?

Feb 15, 2011

I am administrating a lab in a university and every semester we need to delete all the home folders of the accounts for the next semester. I would like to make a bash script that does this automatically and having trouble with it. Note that I am writing my very first bash script. What I need to do is make a script to delete the following:

Delete everything in /home/$exp$num/$dir
when "exp" could be either "rt", "ic" or "sp".
"num" could run from 1(single digit) to 45 and dir is "profile" and "work".

This is what I tried to write:

Code:

#!/bin/sh
cd /home
for exp in "rt ic sp"
do

[code]....

What seems to be the problem is the reading of "$exp$num" as a joint expression.

View 4 Replies View Related

Programming :: Bash: Capture All Output To A Log?

Jun 10, 2010

I have a script that generates a bunch of output, including the expansions details provided by: set -v -xI am trying to pipe everything that is displayed to a file, in addition to displaying it on the screen. I've managed to get stderr and stdout into the file, but the expansions are only printed to the screen. Here is what I have so far:sudo -u <user> source my_job.sh |tee my_log.txt 2>&1

View 2 Replies View Related

Programming :: Bash - How To Control Output Style?

Aug 24, 2009

For example,I have three paragraphs,as following:

I want to output it as following:

View 2 Replies View Related

Programming :: Retain The Eol In Bash Variable Or Ssh Output?

Jan 17, 2011

I have to save the result of ssh/grep into a file to keep the eol ("/n"):

ssh $SSH_OPTIONS $USER@$NODE "cd $LOG_DIR; grep -h '$pattern' log.*" > $file

So that when I grep on the local file again later, it can be printed out with original log lines. Otherwise, the log lines will be dropped and lines becomes concatenated into a single line, e.g., if I rewrite the script in this way, echoing the $result is not a good idea..

result=`ssh $SSH_OPTIONS $USER@$NODES "cd $LOG_DIR; grep -h '$pattern' log.*"`

is there some workaround that I can save it to a variable rather than file but still keep the eol? That will simplify my script and don't need to do all those I/Os!

View 3 Replies View Related

Programming :: Java Output Into Bash Variable?

Feb 20, 2011

I have a bash script that calls a java class method. The method returns a string to the linux console when run independently. how can I assign the value from the java method to a variable in a bash script?running the script: java -cp /opt/my_dir/class.method [parameter]

output: my_string if added in a bash script:

read parameter
java -cp /opt/my_dir/class.method [parameter] | read the_output
echo $the_output

the above doesnt work, I also tried unsuccessfully:

the_output=java -cp /opt/my_dir/class.method [parameter]
the_output=`java -cp /opt/my_dir/class.method [parameter]`
java -cp /opt/my_dir/class.method [parameter] 2>&1

How can i get the output stored into the_output variable?

View 6 Replies View Related

Programming :: Sed In A Bash Loop With Ascending Output?

Jan 1, 2011

I have a file like below:

PU12829,24869;PD15733,24869;PD15733,19785;PD12829,19785;PD12829,24869;
PU4599,20915;PD9924,20915;PD9924,18898;PD4599,18898;PD4599,20915;
PU12829,24869;PD15733,24869;PD15733,19785;PD12829,19785;PD12829,24869;
PU4599,20915;PD9924,20915;PD9924,18898;PD4599,18898;PD4599,20915;
PU1723,3423; #this line is ignored to short

[Code]...

What I'm trying to do is while true, cut each line from file that begins with PU and thats longer than 12 characters and write to a increasing numbered file for each line. Stating with object1 etc.

View 14 Replies View Related

Programming :: Using Bash Command To Execute Output Of Awk?

Mar 24, 2011

I am trying to process a column separated data file, with a few bash command. For example, I have

Code:

file1 aaaa yes
file2 aaaa no
file3 bbbb yes

Let say I want to create new file with the output of first column and do something else with the output of 3rd column. Of course there are many ways to process this data file, but I wish to know by using awk, how could I do it. I'm trying:

Code:

awk '{system("touch $1")}' datafile

but the shell command will not able to get the awk '$1' output. How do I get this done ? And for another question, if the data file contains the variable name of a shell variable, how could I make use of it during a awk output ? For example I have a datafile1:

Code:

server1 yes
server2 no

And in another server declaration data file, I got this datafile2:

Code:

server1=xxx1
server2=yyy1

And in my awk script, I want to achieve something like (the syntax is definitely wrong, just to demonstrate what I assume it will like):

[code]....

View 12 Replies View Related

Programming :: Build Chain (make Or Cmake) For *nix_Movemap Project?

Jun 29, 2010

[URL]...Now it works in Windows platform. Some functions rely on win-specific code and need to cross-platform alternatives. Can some one help to build chain(make or cmake) for this awesome project? any one can compile the Linux generator and transfer the project under *nix platform.

View 1 Replies View Related

Ubuntu Servers :: Redirect Logs From Device Out Of /var/log/messages

May 4, 2010

I have configured my Cisco firewall to redirect all its logs to my Ubuntu 9.1 server (no UI.)

Now, my /var/log/messages is getting all the firewall logs + all other logs.

I'm wondering if there is a way to redirect the logs from my Cisco Firewall (coming from UDP port 514) to another file.

View 2 Replies View Related

Programming :: Bash Output With Timestamp Removing Duplicates

Nov 20, 2010

I'm writing a bash script to auto run on boot in Tinycore.

This is a watered down version.

Code:

I need it to either not add the time stamp if the awk finds a duplicate or write over the time with the new time if awk finds a duplicate.

BTW this is all pretty much cut-and-paste scripting so please feel free to comment if you know a more elegant way.

View 3 Replies View Related

Programming :: Bash: Passing Output To Another Programs Input?

Nov 12, 2009

I am not sure if that Subject really explains it, basically I have a script that executes a CLI java-applet that requires a passphrase from the user. I can easily execute this by issuing the -p argument followed by the passphrase however that shows up on possible logs or at least on the results of the ' ps ' command. If you do not supply this -p argument it provides a new line with the echo " Enter Passphrase: " and asks for input.

how can I provide a result/input for the Passphrase request and is it still possible to throw this application in the background with the ' & ' following the command? I have seen a few examples that show a /bin/expect that expects a result and sends a command however I would like to refrain from any extra dependencies. Example of Regular Execution of application:

Code:

$ /usr/local/***/**** -u USERNAME -r Default-Realm -f certificate.der
Password:

View 6 Replies View Related

Programming :: Bash Scripting - Output As Multiple Files?

Jan 26, 2011

I have wrote a 1 line command that parses a file, locates the IP Address in the file and then trims the output the way I want it, and then sorts numerically and by uniqueness and then >> appends to output.txt

I can get all the IP's into 1 file "output.txt", but what I am really looking for is some type of way to create a text file, for each IP it finds labeled xxx.xxx.xxx.xxx.txt and also put that ip address into that file..

xxx.xxx.xxx.xxx = the ip address it finds

View 14 Replies View Related

Programming :: Changing Color Of Output From Bash Script?

Apr 22, 2010

I am writing a bash script that utilizes the output of another script (which I will refer to as script#2.) Script#2 is not owned by me, I cannot modify it. All of the output from script#2 is blue, which makes it difficult for me to read.

I would like to have the output of it changed to grey. Is there a way I can do that in my script? A command I can pipe the output to?

Edit: One other question related to this. I put a trap function in my script that works well. Script#2 essentially runs a tail -f. When I ctrl+c to stop it, it stops script#2 and never calls the trap in my script. Is there any way I can work around that?

View 3 Replies View Related

Programming :: Organize Bash Script Output Of Which Is Like On Top Command

Sep 12, 2010

Is it possible to organize bash script output of which is like on top command i.e. monitoring every let's say 1 sec and old information would cleared?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved