Search Results

Search: Posts Made By: mjays
8,040
Posted By mjays
this is all done and dusted now but i'd just like...
this is all done and dusted now but i'd just like to say to Arunprasad, you were correct, it's -s i need to use, because the file gets created regardless of any errors. the indication of failure is...
8,040
Posted By mjays
ha ha ha...(to your first sentence - otheus). :) ...
ha ha ha...(to your first sentence - otheus). :)

yes, you're right that method doesn't suit my purpose. i think i'll do a simple check to see if the file got created.

ls -lR ${BUILD_CODE} 2>&1...
8,040
Posted By mjays
erm...where does that fit in with my bit of code?...
erm...where does that fit in with my bit of code?

ls -lR ${BUILD_CODE} 2>&1 >${REL_FILES}/${RELNO}.txt | tee -a ${LOGFILE}
if [ $? -ne 0 ]
then
echo "ERROR - release file creation...
8,040
Posted By mjays
yeah, i've already considered the extra check to...
yeah, i've already considered the extra check to see if the file was created. i was hoping there was a more direct solution using a method i've never seen before. a super advanced system admin/unix...
8,040
Posted By mjays
sorry but i was a little premature. things...
sorry but i was a little premature.

things still aren't right.

the problem is, i need the script to exit if the ls command fails, but all it does is display the error and then write to the log...
8,040
Posted By mjays
that's it, you've cracked it. thanks for...
that's it, you've cracked it.

thanks for your help, and thank you everyone else.

p.s harshakirans - your solution didn't work, i kept getting - cat: cannot open err.txt. thanks though.
8,040
Posted By mjays
cat /dev/null >log.txt; ls -lR...
cat /dev/null >log.txt; ls -lR scripts/release_file.txt >log.txt 2>&1 ; cat log.txt

the problem is, the command is part of a much larger script that outputs lots of info to the log file.
...
8,040
Posted By mjays
KSH problem - how do i redirect three times?
i need to output an ls command to a file but also capture any errors from that command and output them to a log file and the screen.

if it's only possible to output them to a log file and not the...
2,176
Posted By mjays
thanks, that works now. i've just wasted...
thanks, that works now.

i've just wasted about 2 hours trying a billion combinations through being stubborn and refusing to ask for help. i can now move on and finish my work.

cheers very much.
2,176
Posted By mjays
not being able to escape "$" is doing my head in.
why oh why oh why is this happening?

i need to replace the $ with \$ in the file below

file=products_jsp\$products_jspHelper.class

echo $file

products_jsp$products_jspHelper.class

...
4,305
Posted By mjays
yes, using $| = 1; works. i've just googled...
yes, using $| = 1; works.

i've just googled this flushing business and now i understand.

thanks everyone. and thank you cbkihong.....again.
4,305
Posted By mjays
perl - why is the shell script executed before the print command?
i'm writing some simple scripts to help me learn perl.

why does the print command get called after the shell script is executed?

the purpose of the shell script is to simply echo to the screen...
32,811
Posted By mjays
i've figured out a better solution. i didn't...
i've figured out a better solution.

i didn't know there was a 'grep' command until i curiously typed into google "perl +grep". i'm very new to perl by the way.

#!/usr/bin/perl
my $data_file =...
32,811
Posted By mjays
thanks guys. i can use either of those ideas...
thanks guys.

i can use either of those ideas but cbkihong's will be easier to read.

bit annoyed that i didn't think of that myself. i've written loads of unix shell scripts using the 'set...
32,811
Posted By mjays
perl - how do i find out if a file doesn't contain a pattern?
how do i check a file for a pattern and perform an action if it doesn't exist?

i know how to search a file for a pattern. you just place it in an array like so.
#!/usr/bin/perl
my $data_file =...
2,100
Posted By mjays
oh i see. thank you all.
oh i see.

thank you all.
2,100
Posted By mjays
perl - how come this script works?
#!/usr/bin/perl
open (DATA, file.txt);
@array = <DATA>;
close (DATA);

open (DATA, ">$file.txt");
for (@array) {
s/text/replace text/;
push(@contents,$_);
}
seek(DATA, 0, 0);...
95,908
Posted By mjays
i decided to keep it simple. open (STDOUT,...
i decided to keep it simple.

open (STDOUT, "| tee -ai log.txt");
print "blah blah"
close (STDOUT);

thanks for replying everyone,

matt
95,908
Posted By mjays
thanks, i'll try your solution out and see if...
thanks, i'll try your solution out and see if there are any modules.
95,908
Posted By mjays
perl - print to a log file and screen
as the title suggests, i need to print a user message to a log file and the screen using perl.

in unix i set up a function using 'tee' like so

function Display_Message
{
echo "$*" | tee...
4,140
Posted By mjays
i agree. despite my complaining i think the perl...
i agree. despite my complaining i think the perl code looks and somehow feels better.



i think this is the source of my complaint. i've been writing so many unix shell scripts, it's clouded my...
4,140
Posted By mjays
i've now changed the code and it works fine. ...
i've now changed the code and it works fine.

if (! -d "$logdir") {
use File::Path;
eval { mkpath($logdir) };
if ($@) {
print "\nERROR: release log directory creation failed...
4,140
Posted By mjays
perl problem - another 'die' issue.
two things.

why doesn't the 'die' message get displayed - "Error: release log directory creation failed..."?
why does the script name and line number get displayed despite the inclusion of a...
2,305
Posted By mjays
ah that makes sense - both replies. thanks...
ah that makes sense - both replies.

thanks for your help,

matt
2,305
Posted By mjays
perl problem - why isn't 'die' being called?
last week i started learning perl, so have limited skill and knowledge.

why isn't 'die' being called and the script exiting before the 'directory created' line?

if (! -d "$logdir") {
...
Showing results 1 to 25 of 40

 
All times are GMT -4. The time now is 08:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy