Sponsored Content
Top Forums Shell Programming and Scripting Cannot execute Unix command in a simple perl script Post 302558452 by jayachandran87 on Friday 23rd of September 2011 03:07:43 PM
Old 09-23-2011
Thanks for your response..
Code:
$ vgdisplay vgesar | grep -i 'Free PE' | awk '{print $NF}'
69

As i said am just starting with perl. this is one block. Am trying to use perl, as i ll have difficulties comparing floating point values in shell script.

I have already tested this with shell script and works fine. but i just want to know why the same unix command gives the same result as executed in a shell script

---------- Post updated at 12:37 AM ---------- Previous update was at 12:35 AM ----------

As requested by you am pasting the vgdisplay $A

$A here is vgesar -> vgdisplay vgesar
Code:
$ vgdisplay vgesar
--- Volume groups ---
VG Name                     /dev/vgesar
VG Write Access             read/write
VG Status                   available, exclusive
Max LV                      255
Cur LV                      1
Open LV                     1
Max PV                      100
Cur PV                      2
Act PV                      2
Max PE per PV               1599
VGDA                        4
PE Size (Mbytes)            32
Total PE                    3198
Alloc PE                    3129
Free PE                     69
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0


Last edited by Scott; 09-23-2011 at 04:22 PM.. Reason: Code tags...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Net::SSH::Perl->Execute any unix command & display the output in a proper form

Net::SSH::Perl ...... how to print the output in a proper format my $cmd = "ls -l"; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd("$cmd"); print $stdout; the script works fine, but i am unable to see the output... (2 Replies)
Discussion started by: gsprasanna
2 Replies

2. Shell Programming and Scripting

Execute in unix not in PERL

Hi All, This below command is working fine with unix box. However i could not able to run it in PERL. kidly suggest??? perl -ne '{push @x, $_}END{pop(@x); print @x}' create2.txt (15 Replies)
Discussion started by: adaleru
15 Replies

3. Shell Programming and Scripting

perl/unix: script in command line works but not in perl

so in unix this command works works and shows me a list of directories find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt but when i try running a perl script to run this command my $query = 'find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt';... (2 Replies)
Discussion started by: kpddong
2 Replies

4. Shell Programming and Scripting

how to execute ksh simple shell script without creating .sh file

please help me to execute a simple shell script like for i in `ls echo $i done . i dont want to create a new sh file to execute it. Can i just type and execute it ? because I always this kind of simple for loops . Please help . Thanks (7 Replies)
Discussion started by: Sooraj_Linux
7 Replies

5. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

6. Shell Programming and Scripting

execute ssh command via perl

Hi I have a perl command that doesn't seem to be working correctly. It appears to be fine but even when i try and run it manually same thing. Can someone take a look at this and tell me what they think the problem could be? Here is the perl Line: system ("echo 'ssh -t -t $user\@$_ \"cd... (3 Replies)
Discussion started by: vpundit
3 Replies

7. UNIX for Dummies Questions & Answers

Execute a command in different directory through Unix Script

Hi Gurus, I have the below requirement, Execute an unix script which will pick the latest file from the archive directory and do a grep (on multiple patterns) on that file. processingDir="/usr/apps/irdc/informatica/spsf_sales/TgtFiles/ARCHIVE" filename = 'ls Check* | sort -n -k 2 |... (6 Replies)
Discussion started by: diva_thilak
6 Replies

8. Shell Programming and Scripting

Using UNIX command in perl script.

I wish to know if there is any limitation in using unix commands in perl script or it is just we should avoid using them in our perl script. For e.g Below is the command to get the recent file in a dir.: $lcsvFile = `cd "$l_inputfilepath";ls -1t *.CSV|tail -1` Is there any harm in coding... (1 Reply)
Discussion started by: Devesh5683
1 Replies

9. Linux

How to execute a simple select script using a shell script?

Hi team, I have two select statements and need to run them using SYSDBA user select * from temp_temp_seg_usage; select segment_name, tablespace_name, bytes/ (1024*1024) UsedMb from dba_segments where segment_name='TEMP_TEMP_SEG_USAGE'; Need to run this using a shell script say named... (1 Reply)
Discussion started by: pamsy78
1 Replies

10. Programming

PERL: In a perl-scripttTrying to execute another perl-script that SETS SOME VARIABLES !

I have reviewed many examples on-line about running another process (either PERL or shell command or a program), but do not find any usefull for my needs way. (Reviewed and not useful the system(), 'back ticks', exec() and open()) I would like to run another PERL-script from first one, not... (1 Reply)
Discussion started by: alex_5161
1 Replies
vgdisplay(1M)															     vgdisplay(1M)

NAME
vgdisplay - display information about LVM volume groups SYNOPSIS
[vg_name...] vg_vers | vg_name ...] Remarks If a combination of volume groups version 1.0 and 2.0 or higher arguments are supplied, the arguments may not be processed in the order they are listed on the command line. DESCRIPTION
The command displays information about volume groups. For each vg_name specified, displays information for that volume group only. If no vg_name is specified, displays names and corresponding information for all defined volume groups. If the volume group version is speci- fied, displays names and corresponding information for all volume groups belonging to the specified volume group version. The volume group must be activated (see vgchange(1M)) before it can be displayed. Options and Arguments recognizes the following options and arguments: vg_name The path name of the volume group, for example, Display volume group information for all volume groups corresponding to the volume group version vg_vers. Produce a compact listing of fields described in The output is a list of colon separated fields formatted as value...]. For each volume group, display additional information about logical volumes, physical volumes, and physical volume groups. Display Without -v Option If you omit the option, only the following information is displayed: The path name of the volume group. Current access mode and quiesce mode of the volume group. The access mode is either or If the volume group is quiesced, the quiesce mode is displayed on the same line. The quiesce mode is either or State of the volume group: always as after a command, since deactivated volume groups are not displayed. Maximum number of logical volumes allowed in the volume group. Current number of logical volumes in the volume group. Number of logical volumes currently open in the volume group. Maximum number of physical volumes allowed in the volume group. Current number of physical volumes in the volume group. Number of physical volumes that are currently active. Maximum number (limit) of physical extents that can be allocated from any of the physical volumes in the volume group. Number of Volume Group Descriptor Areas within the volume group. Size of each physical extent in Megabytes. Total number of physical extents within the volume group: the sum of the number of physical extents belonging to each available physical volume in the volume group. (This does not include physical extents belonging to stand-by spare physical volumes; presence of these is only possible if you are using mirrored disks -- see below). Number of physical extents currently allocated to logical volumes. Number of physical extents not allocated (not including physical extents belonging to stand-by spares). Total number of physical volume groups within the volume group. Total number of physical volumes that are designated as spares for this volume group. This will include both stand-by and active spares -- see below. Total number of spare physical volumes that are active in place of (containing all data from) a failed physical volume. Volume Group version. The maximum size of the volume group. The units for this display are determined by a suffix: (megabytes), (gigabytes), (terabytes), (petabytes). For example: 256 terabytes would be 256t. For version 1.0 volume groups, it may not be possible to achieve the VG Max Size as it may be limited by the size of each physical volume in the volume group. The maximum number of extents in the volume group (VG Max Size/PE size). For version 1.0 volume groups, it may not be possible to achieve the VG Max Extents as it may be limited by the size of each physical volume in the volume group. Display With -v Option If you specify the option, lists the following additional information for each logical volume, for each physical volume, and for each phys- ical volume group in the volume group: Information about logical volumes belonging to vg_name: The block device path name of a logical volume in the volume group. State of the logical volume: Logical volume available but contains physical extents that are not current. Logical volume available with no stale extents. Logical volume is not available for use. Size of the logical volume. Number of logical extents in the logical volume. Number of physical extents used by the logical volume. Number of physical volumes used by the logical volume. Information about physical volumes belonging to vg_name: The block device path name of a physical volume in the group. When an alternate link to a physical volume has been added, is dis- played next to the device path name. (See vgextend(1M) for definition.) State of the physical volume: ( spare physical volumes are only relevant if you have installed HP MirrorDisk/UX software): The physical volume is available and is not a spare physical volume. The physical volume is available. However, its data still resides on an active spare. The physical volume is available and is an active spare physical volume. (An active spare is a spare that has taken over for a failed physical volume.) The physical volume is a spare "standing by" in case of a failure on any other physical volume in this volume group. It can only be used to capture data from a failed physical volume. The physical volume is unavailable and is not a spare physical volume. The physical volume is unavailable. However, it's data now resides on an active spare, and its data is available if the active spare is available. The physical volume is unavailable and it's an active spare. Thus, the data on this physical volume is unavailable. The physical volume is a spare "standing by" that is not currently available to capture data from a failed physical volume. Total number of physical extents on the physical volume. Number of free physical extents on the physical volume. If the physical volume represents an active spare, this field will show the name of the failed physical volume whose data now resides on this spare. This information can be used to manually move the data back to the original physical volume once it has been repaired (see pvmove(1M)). If it cannot be determined which physical volume that the data came from, this field will instead display A missing PV would indicate that when the volume group was last activated or reactivated (see vgchange(1M)), the "failed" physical volume was not able to attach to the volume group. If the physical volume represents a failed physical volume, this field will show the name of the active spare physical volume that now contains the data that originally residing on this volume. This information can be used to manually move the data back to the original physical volume (see pvmove(1M)) once it has been repaired. For multiported devices accessed via multiple paths, this field indicates the autoswitch behavior for the physical volume (see pvchange(1M)). LVM will automatically switch from the path it is using whenever a better path to the physical volume is available. LVM will switch paths when a better path recovers (after it had failed earlier), or if the current path fails and another path is available. This is the default. LVM will automatically switch to using the best available path only when the path currently in use is unavailable. LVM will continue using a specific path for the physical volume as long as it works, regardless of whether another better path recovers from a failure. This specifies LVM's proactive polling behavior on alternate paths of a physical volume. LVM will periodically test alternate paths of a physical volume and help to identify faulty paths before user I/O is affected. This is the default. No periodic testing of alternate paths of a physical volume will be performed. Information about physical volume groups belonging to vg_name: Name of a physical volume group in the volume group. The block device path name of a physical volume in the physical volume group. Compact listing (-F Option) The option generates a compact and parsable listing of the command output in colon separated fields formatted as value...]. The option is designed to be used by scripts. The resulting command output may be split across multiple lines. The output may include new keys and/or values in the future. If a key is deprecated, its associated value is set to For the current version of the command, the lines format is: The format of Line 1 is as follows: For volume groups version 2.0 or higher two additional fields are added to the LINE 1 format after the vg_version field. vg_name=value:vg_write_access=value:vg_status=value:max_lv=value: cur_lv=value:open_lv=value:max_pv=value:cur_pv=value:act_pv=value: max_pe_per_pv=value:vgda=value:pe_size=value:total_pe=value: alloc_pe=value:free_pe=value:total_pvg=value:total_spare_pvs=value: total_spare_pvs_in_use=value:vg_version=value:vg_max_size=value: vg_max_extents=value: The format of Line 2 is as follows: cluster:server=value:client=value[:...] The format of Line 3 is as follows: lv_name=value:lv_status=value:lv_size=value:current_le=value: allocated_pe=value:used_pv=value The above line may be repeated with different values. The format of Line m is as follows: pv_name=value[,value]:pv_status=value:total_pe=value:free_pv=value: spared_from_pv=value:spared_to_pv=value:autoswitch=value: proactive_polling=value The above line may be repeated with different values. The format of Line n is as follows: pvg_name=value:pv_name=value[,value...] The above line may be repeated with different values. EXTERNAL INFLUENCES
Environment Variables determines the language in which messages are displayed. If is not specified or is null, it defaults to "C" (see lang(5)). If any internationalization variable contains an invalid setting, all internationalization variables default to "C" (see environ(5)). EXAMPLES
Display information about all the volume groups within the system: Display all of the information about one volume group, including the characteristics and status of both the logical and physical extents of the volume group: Display information about all the volume groups within the system that are of version 2.0: SEE ALSO
lvdisplay(1M), lvmadm(1M), pvdisplay(1M), vgchange(1M), vgcreate(1M). vgdisplay(1M)
All times are GMT -4. The time now is 10:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy