Sponsored Content
Full Discussion: Help Syntax Shell-Script
Top Forums Shell Programming and Scripting Help Syntax Shell-Script Post 302343406 by jackcracker on Thursday 13th of August 2009 04:19:55 AM
Old 08-13-2009
Quote:
Originally Posted by chipcmc
two ways:
1- Can you modify the sripts?
2- Redirect stdout of scripts.pp, if script is OK the file size is 0 but if script is NO OK the size is not 0 becaus the are the string "Can /srv/www/htdocs/_source/xml-file not read"
/usr/bin/php5 script1.php >/tmp/script1.$$
if [ -s /tmp/script1.$$ ]
then
echo "Error"
else

fi
rm -f /tmp/script1.$$

Note probe if thestring "Can /srv/www/htdocs/_source/xml-file not read" go out by stdout or by stderr, if is the last (stderr) de redirection is 2>
Version 2 works fine ... many thanks for your help.

---------- Post updated 13-08-09 at 08:19 AM ---------- Previous update was 12-08-09 at 02:58 PM ----------

... have just seen,
when the script runs and there´s an error-message in /tmp/script1.$$
how can the error-message be displayed in the logfile, too?

Code:
 
/usr/bin/php5 script1.php >/tmp/script1.$$
if [ -s /tmp/script1.$$ ]
then
echo 'Script 1 was not read - Error - & **display error-message** '
else
echo 'Script 1 was read - Success'
fi
rm -f /tmp/script1.$$

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script syntax checker

I have a rather big script that i have written in ksh and it is falling over in two places with a 'test argument' error. I know this usually means that the if statement is not correct, but it is fine. I have looked through the rest of the script for any odd brackets or ` marks, but can't see... (2 Replies)
Discussion started by: handak9
2 Replies

2. Shell Programming and Scripting

Basic Shell script syntax help

Hi All, I am new to shell scripting. I have a variable which holds a numeric value.I have to check whether this variable holds a value between(0- 8),(8-17)(17-24).How do i write this syntax using if in shell scripting. Thanks Vignesh (2 Replies)
Discussion started by: vignesh53
2 Replies

3. Shell Programming and Scripting

How to Check Shell script syntax w/o executing

Hello All, I looking for a way to verify the correction of shell script syntax. Is there any switch like -c in perl which do this in shell ? Thank You. (1 Reply)
Discussion started by: Alalush
1 Replies

4. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

5. Emergency UNIX and Linux Support

Seek help on shell script syntax errors

I want to delete archivelog files that has been archived and applied from primary database to standby database. This piece of script is working in Linux server. However, I copy it to Unix server with tiny modification. It won't work and generate the error message. I have checked code carefullt... (8 Replies)
Discussion started by: duke0001
8 Replies

6. Shell Programming and Scripting

shell script | bc syntax format

sorry but need help http://i.investopedia.com/inv/articles/site/CalculationEMA.gif trying to achieve ema in script I have this syntax which errors ema=` ; the 0.153846154 ='s Smoothing Factor really appreciate help (3 Replies)
Discussion started by: harte
3 Replies

7. Shell Programming and Scripting

Syntax Error in Unix Shell Script

I am trying to run a unix script in my home directory.Snippet below echo "`date '+%Y%m%d_%H%M%S'` Getting ProductList.dat" if ( -f $DIR/ProductList.dat) then cp $DIR/ProductList.dat MigratedProductList.dat else echo "`date '+%Y%m%d_%H%M%S'`ProductList.dat does not exist; Processing... (4 Replies)
Discussion started by: Mary James
4 Replies

8. Shell Programming and Scripting

syntax error in shell script

I am creating a shell script. In which, I need to get server name and server IP. I used this command in script. servername=`cat /etc/hosts|grep `eval hostname`|awk '{print $2}'` however, when execute script or put set -x to debug, it return: line 13: syntax error at line 13: `|' unexpected... (4 Replies)
Discussion started by: duke0001
4 Replies

9. Shell Programming and Scripting

Help with Check Syntax of Shell Script without Running

Hi Everyone, Is there any way ( generic) to check syntax of Shell Scripts without running it?? (4 Replies)
Discussion started by: roy121
4 Replies

10. Shell Programming and Scripting

Help with if statement syntax in shell script

I want to make the file test condition a variable ($Prmshn in code below). My goal is to use something like the first three unsuccessful if statetments since the 'if #!/bin/ksh test_input() { Prmshn=${1} InFLNm=${2} ifReq="-$Prmshn $InFLNm" #the following three if statments fail: #if ] ;... (10 Replies)
Discussion started by: ms63707
10 Replies
pullupmsg(9F)						   Kernel Functions for Drivers 					     pullupmsg(9F)

NAME
pullupmsg - concatenate bytes in a message SYNOPSIS
#include <sys/stream.h> int pullupmsg(mblk_t *mp, ssize_t len); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
mp Pointer to the message whose blocks are to be concatenated. mblk_t is an instance of the msgb(9S) structure. len Number of bytes to concatenate. DESCRIPTION
pullupmsg() tries to combine multiple data blocks into a single block. pullupmsg() concatenates and aligns the first len data bytes of the message pointed to by mp. If len equals -1, all data are concatenated. If len bytes of the same message type cannot be found, pullupmsg() fails and returns 0. RETURN VALUES
On success, 1 is returned; on failure, 0 is returned. CONTEXT
pullupmsg() can be called from user or interrupt context. EXAMPLES
Example 1: Using pullupmsg() This is a driver write srv(9E) (service) routine for a device that does not support scatter/gather DMA. For all M_DATA messages, the data will be transferred to the device with DMA. First, try to pull up the message into one message block with the pullupmsg() function (line 12). If successful, the transfer can be accomplished in one DMA job. Otherwise, it must be done one message block at a time (lines 19-22). After the data has been transferred to the device, free the message and continue processing messages on the queue. 1 xxxwsrv(q) 2 queue_t *q; 3 { 4 mblk_t *mp; 5 mblk_t *tmp; 6 caddr_t dma_addr; 7 ssize_t dma_len; 8 9 while ((mp = getq(q)) != NULL) { 10 switch (mp->b_datap->db_type) { 11 case M_DATA: 12 if (pullupmsg(mp, -1)) { 13 dma_addr = vtop(mp->b_rptr); 14 dma_len = mp->b_wptr - mp->b_rptr; 15 xxx_do_dma(dma_addr, dma_len); 16 freemsg(mp); 17 break; 18 } 19 for (tmp = mp; tmp; tmp = tmp->b_cont) { 20 dma_addr = vtop(tmp->b_rptr); 21 dma_len = tmp->b_wptr - tmp->b_rptr; 22 xxx_do_dma(dma_addr, dma_len); 23 } 24 freemsg(mp); 25 break; . . . 26 } 27 } 28 } SEE ALSO
srv(9E), allocb(9F), msgpullup(9F), msgb(9S) Writing Device Drivers STREAMS Programming Guide NOTES
pullupmsg() is not included in the DKI and will be removed from the system in a future release. Device driver writers are strongly encour- aged to use msgpullup(9F) instead of pullupmsg(). SunOS 5.10 11 Nov 1996 pullupmsg(9F)
All times are GMT -4. The time now is 11:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy