Sponsored Content
Top Forums Shell Programming and Scripting Why Does this Shell Script Hang? Post 302370816 by Zoetermeer on Thursday 12th of November 2009 01:04:39 PM
Old 11-12-2009
Why Does this Shell Script Hang?

I have this short and simple shell script that processes a log file with the following format:

[function address in hex notation] [timestamp when it was invoked]

and attempts to generate output in the following format:

[function name] [timestamp when it was invoked]

I've come up with the following, but for some reason, it only prints output correctly for the first line of the input file, then hangs indefinitely:

Code:
#!/bin/bash 

for line in $(egrep -o "(0x[0-9a-fA-F]+)\s[0-9]+\.[0-9]+" ./syntax_check_out.txt)
    do 
        addr=`echo $line | egrep -o "0x[0-9a-fA-F]+"` 
        stamp=`echo $line | egrep -o "[0-9]+\.[0-9]+"`
        func=`addr2line -f -e ../mzscheme3m $addr | head -1`
     
        echo "${func} ${stamp}"        
done

Any ideas why this isn't working? I'm not very good with shell scripting, so I may have made an obvious mistake.

Thanks all in advance!

Last edited by Franklin52; 11-12-2009 at 02:11 PM.. Reason: Please use code tags!
 

10 More Discussions You Might Find Interesting

1. SuSE

Hang a Process

this may be something trivial to many of you, but is there a way to purposely cause a process to hang? (6 Replies)
Discussion started by: laila63
6 Replies

2. Red Hat

system hang

Hello, I am having a HP proliant 350 G3 sever installed wih RedHat linux 9.0 when I enterd using any user(Except root) the server hanged after few seconds, also the folder icons are blacked out and the names of the folder icons are disapper. can any body help me. Ajay (1 Reply)
Discussion started by: ajay234
1 Replies

3. AIX

Boot from CD hang

Why is one of my blade hanging and does nothing after trying to boot from CD??? ================== I tried to press 1....JS20 does not support SMS menu Here's what I see after 30 minutes... ------------------------------------------------------------------------------- ... (0 Replies)
Discussion started by: mifch
0 Replies

4. Shell Programming and Scripting

Hang in linux

Hi guys sorry for my English I am from GREECE and I speak from translator.I have in my school work to hang the program I've done is this encounter the problems is that the meter that I have put on the mistakes does not work (I have not stated anywhere lathi = 0, not to reset the meter at each of... (1 Reply)
Discussion started by: soula
1 Replies

5. Shell Programming and Scripting

how do i avoid system hang due to ssh in script?

I have a script that collects data from about 200 servers using 'ssh'. The problem is that, process sometime hangs at some point stopping the execution of the script. Please give me some idea how can I force the execution to jump to the next step if there arises any problem !! Thanks for replies if... (1 Reply)
Discussion started by: mdangol
1 Replies

6. Shell Programming and Scripting

Script to Kill process which is in hang state

Hi, Can anyone help to create a script that will kill the process which is in hang state. (1 Reply)
Discussion started by: A.Santhosh
1 Replies

7. IP Networking

netstat -a hang

Hi, on our Solaris 10 servers, one day 'netstat -a' command return very slow after TCP output, wait 5 minute on this line - SCTP: Local Address Remote Address Swind Send-Q Rwind Recv-Q StrsI/O State ------------------------------- ------------------------------- ------ ------ ------ ------... (6 Replies)
Discussion started by: ora_dba
6 Replies

8. Solaris

ALOM hang

Hi guys, I'm new with solaris. I just received sunfire T2000 server. Problem: ALOM keep hang/stuck/jammed. Steps do before it hang : 1. Connect to T2000 (using RJ45 - DB9 cable) 2. Open putty, connect via serial. 3. Power on the server. 4. Its loading. 5. then, hang. ... (1 Reply)
Discussion started by: rajasraf
1 Replies

9. Shell Programming and Scripting

Hang NFS shell script check

Hello all, i wrote a shell script that was running perfectly fine until we had some issue with our NFS server and the script was hung. This script runs every 20 mins and obviously as we had the NFS issue, the script start to hang. as i do a check to make sure NFS directory is avaiable or not.... (7 Replies)
Discussion started by: crazy_max
7 Replies

10. Shell Programming and Scripting

How to solve hang issue in script?

i have one function block in the beginning of my script and there are some commands inside that function which will perform some operations. And i am invoking that function from my main script by passing some values. Sometimes it is hanging in the middle for some value. For example: For 1st... (3 Replies)
Discussion started by: thomasraj87
3 Replies
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.10 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 10:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy