Sponsored Content
Full Discussion: Shell script debugging
Top Forums Shell Programming and Scripting Shell script debugging Post 302813659 by Don Cragun on Tuesday 28th of May 2013 01:30:50 AM
Old 05-28-2013
We understand that the command:
Code:
cat abc.txt | grep 123

prints any line in the file abc.txt that contains the string "123". We understand that the command:
Code:
grep 123 abc.txt

does exactly the same thing much more efficiently.

You're saying that the command:
Code:
[if $DISPLAY xstatus | $GREP "$right...$right" ]

is running whatever $GREP expands to before it runs the command [if. This will probably give a syntax error because you most likely do not have a utility named [if. Since you won't tell us what error was displayed, you haven't told us what system you're using, you haven't told us what shell you're using, and you won't even use CODE tags; you're asking us to work with our hands tied behind our backs. I can guess that you would probably have better luck with:
Code:
if [ $DISPLAY xstatus | $GREP "$right...$right" ]

but there is no way that we can guess whether or not that might do what you want done with the information you have provided.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

HP-UX Debugging Shell script

Hi, I was using AIX - ksh shell , and inorder to debug shell script I used set -vx to echo all the commands which are being executed. Can anybody tell me the corresponding method in HP-UX - in tcsh shell. Regards Shihab (1 Reply)
Discussion started by: shihabvk
1 Replies

2. Shell Programming and Scripting

FTP script debugging

Hello all, I am trying to run a script and have not had much success running it...ne help debugging it will be appreciated..The ftp script alone works but not within the while loop. below is the script #!/usr/bin/ksh destination_server=servename destination_user_id=un... (1 Reply)
Discussion started by: alfredo123
1 Replies

3. Shell Programming and Scripting

debugging a script??

Hi all, Am working on a script to understand the flow control of it.. Since i am from a C background i looking out for an easy way to analyze the script as it runs .. In C/C++ we have F7 that starts execution from main() and proceeds accordingly.. I was wondering if there is a same approach... (2 Replies)
Discussion started by: wrapster
2 Replies

4. UNIX for Advanced & Expert Users

which one method is best for debugging the shell script?

Hi All, How to debug the unix shell script? which one is the best way to do the debuging ? suggession would be appreciate Regards, Siva P Bangalore (2 Replies)
Discussion started by: psiva_arul
2 Replies

5. Shell Programming and Scripting

script debugging

is there any way you can add a breakpoint in a script so you can stop on it? i have used -xv in my shebang but the script just runs and i want it to stop at a specific point in the script. appreciate any help. (1 Reply)
Discussion started by: npatwardhan
1 Replies

6. Shell Programming and Scripting

debugging the shell script with out actually running

Hello, Some one asked me in the inteview.... The question is, How do we debug the schell script before even running..... Interviewer told me one clue... There is SET command to accomplish this... Can any one tell me what kind of set commands.... Thanks. (2 Replies)
Discussion started by: govindts
2 Replies

7. Shell Programming and Scripting

Debugging shell scripts

Any there any utilities or ways of debugging shell scripts? I know something like: sh -x <script> (1 Reply)
Discussion started by: proactiveaditya
1 Replies

8. Shell Programming and Scripting

Debugging a beginner shell script...

I have been following a tutorial on bash which has proven to be very helpful. However, i am stuck with a command not found issue when asking for a y/n response from the user. Below is the part of code I believe is giving me grief... I have been trying to work through this for 3 hours now.... Please... (5 Replies)
Discussion started by: brokepunk
5 Replies

9. Shell Programming and Scripting

Debugging a script with noexec

Newbie question. I cannot get "set -n" or "set -noexec on" to work on Linux or AIX! According to the man page and what I read online, it should inform me of syntax errors without executing commands in your script. So, can someone PLEASE explain why this does not work? ... (2 Replies)
Discussion started by: fgoyti
2 Replies

10. Shell Programming and Scripting

Debugging mode while executing Unix Shell Scripting

Hi, Is there any debugging tool for Unix Shell Script like we have gdb in C/C++? Also please let me know how to close the thread is it automatic or we have to close it manually. Thanks and Regards (1 Reply)
Discussion started by: diehard
1 Replies
ZGREP(1)                                                      General Commands Manual                                                     ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 10:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy