Sponsored Content
Top Forums Shell Programming and Scripting Not able to get value in 3rd variable Post 302693945 by sdosanjh on Thursday 30th of August 2012 03:27:27 AM
Old 08-30-2012
Not able to get value in 3rd variable

Perl Legends,

I am trying to debug below perl script. Till "h1" and "h2" the value in variable is initialized. but as soon as it execute the command for 3rd variable "h3" it terminates.

Code:
$h1=`/usr/bin/head -1 /tmp/a/$ARGV[3]`;
print TEST "after h1\n";
print TEST "$h1\n";

$h2=`/usr/bin/head -1 /tmp/b/$ARGV[3]`;
print TEST "after h2\n";
print TEST "$h2\n";

$h3=`/usr/bin/head -1 /tmp/c/$ARGV[3]`;
print TEST "after h3\n";
print TEST "$h3\n";


@head = ( $h1, $h2, $h3 );

print TEST "after head1\n";
                        $h = 0;
                        foreach $header (@head) {
                                if ($header =~ /Host/) { $h++; }
                        }
print TEST "after head2\n";




OUTPUT

after h1
# Host: a Start time: 08/30/12 01:30:56

after h2
# Host: b Start time: 08/30/12 01:30:56

--- And it terminates after h2

Pls help
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to change every 3rd character

hey champs, i have a files, whose contents are as follows, abcdefghijk lmnopqrstuv .............. .............. i want to replace every other 3rd character to some specified character. let here in this file i want to replace each 3rd character to z. abzdezghzjk lmzopzrszuv... (2 Replies)
Discussion started by: manas_ranjan
2 Replies

2. Shell Programming and Scripting

How to define a variable with variable definition is stored in a variable?

Hi all, I have a variable say var1 (output from somewhere, which I can't change)which store something like this: echo $var1 name=fred age=25 address="123 abc" password=pass1234 how can I make the variable $name, $age, $address and $password contain the info? I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies

3. Shell Programming and Scripting

will only show every 3rd line

Hi, how will i show every 3rd line of the file. Ex. line 1 line 2 line 3 line 4 line 5 line 6 line 7 Output: line 2 line 5 line 6 tyhanks ---------- Post updated at 03:39 AM ---------- Previous update was at 03:37 AM ---------- (2 Replies)
Discussion started by: kenshinhimura
2 Replies

4. Shell Programming and Scripting

Need to get the 3rd column

Hi Trying to do get the 3rd column out. Any help would be much appreciated Hardware OS Client --------------- --------------- -------------- PC WindowsNET test1 PC WindowsNET test2 PC WindowsNET test3... (6 Replies)
Discussion started by: bombcan1
6 Replies

5. Programming

libnotify (g_signal_connect() 3rd argument help) c++

Hello, this is my code: #include <glib.h> #include <unistd.h> #include <libnotify/notify.h> void push_notification (gchar* title, gchar* body, gchar* icon) { NotifyNotification* notification; gboolean success; ... (0 Replies)
Discussion started by: hakermania
0 Replies

6. Shell Programming and Scripting

Decrement one from 3rd Column

Hi, I need a script that will subtract 1 from the third column of the line beginning with %, leaving all other values the same. So 158 should be 157, 308 should be 307, 458 should be 457. Before: # 30109 xyz abc Data % 30109 158 5 8 2 000023f 01f4145 # 30109 ... (3 Replies)
Discussion started by: morrbie
3 Replies

7. Shell Programming and Scripting

how to get 3rd week of every friday?

Legends, how do i get 3rd week of friday in every month and execute a particular script say /tmp/abc.sh ??? i think after "cal" we can traverse through using some for loop.:wall: pls help me. Dosanjh (8 Replies)
Discussion started by: sdosanjh
8 Replies

8. AIX

PowerHA with 3rd node for communication

Looking to find PowerHA with 3rd node used for communication (voting node) only. Does anyone use such configuration with IBM products? (2 Replies)
Discussion started by: gogogo
2 Replies

9. Shell Programming and Scripting

Compare 3rd column in 2 files

I have the following 2 files. File 1 08FB,000192602673,10000000c9a6b240 0121,000192602673,20000025b550101f 0121,000192602673,20000025b550100f 08FA,000192602673,10000000c9a6b240 File 2 18F2,000195702363,10000000c9a6b240 18F3,000195702363,10000000c9a6b240... (2 Replies)
Discussion started by: kieranfoley
2 Replies

10. Solaris

3rd field in /etc/shadow

Searched and searched, but could not find a official answer. In Solaris, on a new server build, all the system accounts look like this: # cat /etc/shadow root:#########:6445:::::: daemon:NP:6445:::::: bin:NP:6445:::::: sys:NP:6445:::::: adm:NP:6445:::::: lp:NP:6445::::::... (6 Replies)
Discussion started by: flyddw
6 Replies
SG_TURS(8)							     SG3_UTILS								SG_TURS(8)

NAME
sg_turs - send one or more SCSI TEST UNIT READY commands SYNOPSIS
sg_turs [--help] [--number=NUM] [--progress] [--time] [--verbose] [--version] DEVICE sg_turs [-n=NUM] [-p] [-t] [-v] [-V] DEVICE DESCRIPTION
This utility sends one or more SCSI TEST UNIT READY commands to the DEVICE. This may be useful for timing the per command overhead. Note that TEST UNIT READY has no associated data, just a 6 byte command and a returned SCSI status value. This utility supports two command line syntaxes, the preferred one is shown first in the synopsis and explained in this section. A later section on the old command line syntax outlines the second group of options. OPTIONS
Arguments to long options are mandatory for short options as well. -h, --help print out the usage message then exit. -n, --number=NUM performs TEST UNIT READY NUM times. If not given defaults to 1. These suffix multipliers are permitted: c C *1; w W *2; b B *512; k K KiB *1,024; KB *1,000; m M MiB *1,048,576; MB *1,000,000; g G GiB *1,073,741,824; and GB *1,000,000,000 . Also a suffix of the form "x<n>" multiplies the leading number by <n>. Alternatively a hex number may be given, prefixed by either '0x' or has a trailing 'h'. -O, --old switch to older style options. -p, --progress show progress indication (a percentage) if available. If --number=NUM is given, NUM is greater than 1 and an initial progress indi- cation was detected then this utility waits 30 seconds before subsequent checks. Exits when NUM is reached or there are no more progress indications. Ignores --time option. See NOTES section below. -t, --time after completing the requested number of TEST UNIT READY commands, outputs the total duration and the average number of commands executed per second. -v, --verbose increase level or verbosity. -V, --version print version string then exit. NOTES
The progress indication is optionally part of the sense data. When a prior command that takes a long time to complete (and typically pre- cludes other media access commands) is still underway, the progress indication can be used to determine how long before the device returns to its normal state. The SCSI FORMAT command for disks used with the IMMED bit set is an example of an operation that takes a significant amount of time and precludes other media access during that time. The IMMED bit set instructs the FORMAT command to return control to the application client once the format has commenced (see SBC-3). Several long duration SCSI commands associated with tape drives also use the progress indication (see SSC-3). Early standards suggested that the SCSI TEST UNIT READY command be used for polling the progress indication. More recent standards seem to suggest the SCSI REQUEST SENSE command should be used instead. EXIT STATUS
The exit status of sg_turs is 0 when it is successful. Otherwise see the sg3_utils(8) man page. OLDER COMMAND LINE OPTIONS
The options in this section were the only ones available prior to sg3_utils version 1.23 . In sg3_utils version 1.23 and later these older options can be selected by either setting the SG3_UTILS_OLD_OPTS environment variable or using '--old' (or '-O) as the first option. -n=NUM performs TEST UNIT READY NUM times. If not given defaults to 1. Equivalent to --number=NUM in the main description. -N switch to the newer style options. -p show progress indication (a percentage) if available. Equivalent to --progress in the main description. -t after completing the requested number of TEST UNIT READY commands, outputs the total duration and the average number of commands executed per second. Equivalent to --time in the main description. -v increase level of verbosity. -V print out version string then exit. AUTHORS
Written by D. Gilbert COPYRIGHT
Copyright (C) 2000-2008 Douglas Gilbert This software is distributed under the GPL version 2. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- POSE. SEE ALSO
sg_inq, sg_request (sg3_utils) sg3_utils-1.26 March 2008 SG_TURS(8)
All times are GMT -4. The time now is 09:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy