Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Check Success Status Of sed command Post 302848655 by jim mcnamara on Thursday 29th of August 2013 04:58:04 PM
Old 08-29-2013
Make the small change in red at the bottom:
Code:
#!/bin/bash -x
. /home/infrmtca/bin/dwh_Loadfuncs.sh

SetVar

check()
{
if [ $? -eq 0 ]
then
        echo "success"
else
        echo "failure"
        exit
fi
}


sed -i 's%SOURCEFOLDERNAME=[^ ]*%SOURCEFOLDERNAME='\"${FOLDER}\"'%g' DepFolderControlFile.xml
check $?

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Success status of mailx command

Hi I want to know if the email address in the mailx exists or not Eg: Mailx -s "Subj" hello@ab.com How do I know if the email address is a valid one??? (4 Replies)
Discussion started by: superprogrammer
4 Replies

2. Shell Programming and Scripting

check the status and send an email with status

Hi, We have a text file which has the following data. ISA~00~ ~00~ ~ZZ~VISTN ~ZZ~U1CAD ~051227~183 7~U~00200~000011258~0~P~< GS~FA~EE05J~U1CAD~051227~1831~000011258~X~002002 ST~997~0001 AK1~SH~247 AK2~856~2470001 AK5~A AK2~856~2470002 AK5~A... (3 Replies)
Discussion started by: isingh786
3 Replies

3. Shell Programming and Scripting

Failed to check status code in "rsh" command

Hi folks, I wrote a ksh program which run scripts from remote server. To check the status code I wrote the following function: check_remote_status() { status_code=`tail -1 $installLog` if ] ; then echo $errMsg | tee -a $installLog exit 1 else echo $validMsg >> $installLog fi... (9 Replies)
Discussion started by: nir_s
9 Replies

4. Shell Programming and Scripting

How to check status of last print command?

I am working on an Linux based application where I am using lp -onobanner -s -d$RPTDEST command to print the file on desired printer. Variable $RPTDEST could be different each time even for the same user. I need to implent the check if last print command was succesful or not, so that application... (3 Replies)
Discussion started by: dpmore
3 Replies

5. Shell Programming and Scripting

How to check status of tar command?

Hi, How to check the status of tar command using bash script ? I have the following tar command, how to check the status of the tar? tar -cjf $today.tar.bz2 /opt/data Regards, Eye Gee (1 Reply)
Discussion started by: egkua
1 Replies

6. Shell Programming and Scripting

Success/failure status of telnet connection

Hi, I am running a shell script which will spawn the telnet and login. But sometimes, the telnet session itself is not getting spawned. My requirement is, if the telnet session is not spawned, the user must be notified that it failed. Is there any command to capture the status of telnet... (2 Replies)
Discussion started by: merin
2 Replies

7. UNIX for Dummies Questions & Answers

Check the exist status of the cd command

Hi, As in scripting , some cd commands getting failed, so we do check the exist status as 0 or 1. But every time we call to function for it. But does any single line exist will do the job with || , && ? i.e ls -l Logs cd Logss | exit echo hias Logss is not exist , Before printing "hi" we... (5 Replies)
Discussion started by: posix
5 Replies

8. Programming

Python Conditional Statements Based on Success of Last Command

In shell scripting, I can create a conditional statement based on the success or failure (exit status)of a command such as: pinger() { ping -c 2 $remote_host >/dev/null 2>&1 ping_stat=$? } pinger if ]; then echo "blahblahblah" exit 0 fi how is this done using Python using... (3 Replies)
Discussion started by: metallica1973
3 Replies

9. Shell Programming and Scripting

sed commands success / fail from commandline vs ksh script

solaris 5.10 Generic_138888-03 sun4v sparc SUNW,Sun-Fire-T200 I need a sed command that tests true when presented with lines that contain either forward and backslash. input file: c:/myFile.txt c:\yourFile.txt It doesn't appear that sed (in my environment anyway) supports... (4 Replies)
Discussion started by: msutfin
4 Replies

10. Shell Programming and Scripting

Check/get the exit status of a remote command executed on remote host through script

Geeks, Could you please help me out in my script and identify the missing piece. I need to check/get the exit status of a remote command executed on remote host through script and send out an email when process/processes is/are not running on any/all server(s). Here's the complete... (5 Replies)
Discussion started by: lovesaikrishna
5 Replies
IMAGECOLORCLOSESTHWB(3) 						 1						   IMAGECOLORCLOSESTHWB(3)

imagecolorclosesthwb - Get the index of the color which has the hue, white and blackness

SYNOPSIS
int imagecolorclosesthwb (resource $image, int $red, int $green, int $blue) DESCRIPTION
Get the index of the color which has the hue, white and blackness nearest the given color. PARAMETERS
o $ image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3). o $red -Value of red component. o $green -Value of green component. o $blue -Value of blue component. RETURN VALUES
Returns an integer with the index of the color which has the hue, white and blackness nearest the given color. EXAMPLES
Example #1 Example of using imagecolorclosesthwb(3) <?php $im = imagecreatefromgif('php.gif'); echo 'HWB: ' . imagecolorclosesthwb($im, 116, 115, 152); imagedestroy($im); ?> The above example will output something similar to: HWB: 33 CHANGELOG
+--------+--------------------------------------------+ |Version | | | | | | | Description | | | | +--------+--------------------------------------------+ | 5.3.0 | | | | | | | This function is now available on Windows | | | | +--------+--------------------------------------------+ SEE ALSO
imagecolorclosest(3). PHP Documentation Group IMAGECOLORCLOSESTHWB(3)
All times are GMT -4. The time now is 11:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy