Sponsored Content
Top Forums Shell Programming and Scripting A function in shell script,how can i get the right result Post 302385400 by fw0037 on Friday 8th of January 2010 02:55:24 AM
Old 01-08-2010
Network A function in shell script,how can i get the right result

there is a directory /data/users/osa/psidp/dmp/files/cimdir ,it have some subdirectories ,and also the subdirectoriy have it's subdirectoriis.
I want to get all the leaf nodes of the directory path .
but the result of the script is wrong ,how can i get the right result

somebody who can help me !!!!



the script name is fw.sh :

Code:
hanshu()
{
dirnum=`find $1 -type d|wc -l`
if [ $dirnum != 1 ]; then
set -A subDir `ls -l $1| awk '{if (substr($0,1,1)~"d") print $8}'`
typeset -i i
i=0
while [ $i -lt $dirnum ]
do
subDir[$i]=$1"/"${subDir[$i]}
hanshu ${subDir[$i]}
if [ "${subDir[$i]}" != "" ]; then
echo "/"${subDir[$i]}
fi
i=`expr $i + 1`
done
fi
}
hanshu $1





for example,when i run

Code:
fw.sh /data/users/osa/psidp/dmp/files/cimdir

i want get the value is :
Code:
//data/users/osa/psidp/dmp/files/cimdir/scm/1.04
//data/users/osa/psidp/dmp/files/cimdir/scm_version
//data/users/osa/psidp/dmp/files/cimdir/version

but the anwser is :
Code:
//data/users/osa/psidp/dmp/files/cimdir/scm/1.04
//data/users/osa/psidp/dmp/files/cimdir/scm/1.04

how can i get the right result what i want?
thanks!

Last edited by pludi; 01-08-2010 at 04:04 AM.. Reason: Added code tags, remove unnecessary formatting
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Could any one tell me how to do get result in fraction in shell script

Could any one tell me how to do get result in fraction in shell script. I am using expr for division of 2 number but it is giving Quitent. I need it in full fraction value. please helpp. how to do it using "dc" or "bc" (5 Replies)
Discussion started by: Neerajjaiswal
5 Replies

2. AIX

The shell script is not returning proper result

Can anybody pls look into this script and tell me where I went wrong. After running this script, it is showing like "Trying to overlay current working directory ABORT!!!" :-( ARGCNT=$# if then echo "Two parameters are needed for this shell " echo "Please try again with... (1 Reply)
Discussion started by: clnsharma123
1 Replies

3. Shell Programming and Scripting

get result from database into shell script

hi, I have a script that will logon to a database siebel and do the select query and then get the result in command prompt of unix.Below the script. #!/bin/ksh . $HOME/conf/systemProperties/EnvSetup.properties #set -x while read i do echo $i connect1=`sqlplus -silent... (1 Reply)
Discussion started by: ali560045
1 Replies

4. Shell Programming and Scripting

shell script result to file

Since I'm not an expert in shell scripting, I have question on sending script result to file. I have script like this... if condition=0: then echo "service is not running" | mail -s "Server Status" uname@companyname fi sleep 10 if configtion=1: then echo "service is not running" | mail -s... (3 Replies)
Discussion started by: s_linux
3 Replies

5. Homework & Coursework Questions

A function in shell script,how can i get the right result

there is a directory /data/users/osa/psidp/dmp/files/cimdir ,it have some subdirectories ,and also the subdirectoriy have it's subdirectoriis. I want to get all the leaf nodes of the directory path . but the result of the script is wrong ,how can i get the right result somebody who can help... (1 Reply)
Discussion started by: fw0037
1 Replies

6. Shell Programming and Scripting

a function in shell script,how can i get the right result

there is a directory /data/users/osa/psidp/dmp/files/cimdir ,it have some subdirectories ,and also the subdirectoriy have it's subdirectoriis. I want to get all the leaf nodes of the directory path . but the result of the script is wrong ,how can i get the right result somebody who can... (1 Reply)
Discussion started by: fw0037
1 Replies

7. Shell Programming and Scripting

SHELL SCRIPT Function Calling Another Function Please Help...

This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord but only one record is getting wrote in DB.... Please advise ASAP...:confused: function InsertFtg { FTGSTR="" echo "Saurabh is GREAT $#" let... (2 Replies)
Discussion started by: omkar.sonawane
2 Replies

8. Shell Programming and Scripting

shell script - unexpected result

I hv a file --am executing a script which is giving me unexpected results COntents of file: f1 CMT_AP1_CONT:/opt/sybase/syboc125:150:ASE12_5::Y:UX: CMT_AP1:/opt/sybase/syboc125:150:ASE12_5::Y:UX f1.tmp CMT_AP1_CONT:/opt/sybase/syboc125:150:ASE12_5::Y:UX:... (2 Replies)
Discussion started by: rajashekar.y
2 Replies

9. Shell Programming and Scripting

Executing the result of a program as a shell script

I have a program that returns a shell script and I want to execute the script. I'll use cat in my simple example, but wget is an example that is feasible. $ # First setup a script $ echo "ls > df" > simple $ # "cat simple" is now a program that returns a script $ cat simple ls df $ ... (3 Replies)
Discussion started by: kopite
3 Replies

10. Programming

Query result from shell script

Hi, I wrote the below script to get the query result from a Syabase DB. isql -s -U **** -P **** SYBASE SERVERNAME USE ***(Database name in Sybase) @command.sql But im not getting the output. Can anyone help me on this (2 Replies)
Discussion started by: rohan G
2 Replies
vxdmp(7)						 Miscellaneous Information Manual						  vxdmp(7)

NAME
vxdmp - Veritas Volume Manager multipathing disk devices DESCRIPTION
Multipathed disk devices in Veritas Volume Manager (VxVM) represent virtual devices with one or more physical access paths to a physical disk. The Multipathing feature provides disk access reliability by dynamically switching to another physical path if there is a path fail- ure. Every disk that is visible to VxVM is represented by a multipath device node in the /dev/vx/dmp and /dev/vx/rdmp directories for block type and character type interfaces. A simple disk is represented by a multipath device having one physical path, whereas a disk that is part of a multiported disk array is represented by a multipath device with many device access paths depending upon the type of the disk array. VxVM uses standard disk device naming conventions to name multipath devices. For example, if there is a disk device with two physical access paths such as c1t0d0 and c2t0d0, the multipathing device node for this particular disk is created under /dev/vx/dmp and /dev/vx/rdmp as c1t0d0 or c2t0d0. To provide multipathing, VxVM maintains an internal database of all the multipathed devices detected by the system and their respective paths. The database is created at system boot time. When disks are added or removed from the system, VxVM provides support to reconfigure the multipath device database to reflect new states of the hardware, while the system is online. To reconfigure the DMP database, run ioscan followed by insf, and then invoke vxdctl enable (see vxdctl(1M)). The various access paths to a multipathed device can be seen by using a vxdisk command (see vxdisk(1M)). These commands open the multi- pathing configuration device /dev/vx/dmpconfig to obtain the required information about the various paths to a multipathed device and their states. VxVM also provides the facility to enable or disable a disk controller. This feature can be used to stop all I/Os through a particular con- troller to perform maintenance operations on it. Use the vxdmpadm command to do this and also perform other operations on the multipath device database. VxVM can provide notification about events that occur in the DMP database due to a change in hardware. See the vxnotify(1M) man page for more information. VxVM is capable of multipathing both Active/Active and Active/Passive disk arrays. FILES
/dev/vx/dmp Multipathing block devices. /dev/vx/rdmp Multipathing character devices. SEE ALSO
ioctl(2), vxdctl(1M), vxdisk(1M), vxdmpadm(1M), vxnotify(1M) VxVM 5.0.31.1 24 Mar 2008 vxdmp(7)
All times are GMT -4. The time now is 08:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy