Sponsored Content
Top Forums Shell Programming and Scripting sh script to traul through /usr/lib/perl5 ... Post 25860 by emcb on Tuesday 6th of August 2002 04:53:44 PM
Old 08-06-2002
Tools sh script to traul through /usr/lib/perl5 ...

Hey,

Im trying to create a script to create a dir-tree of pod converted to html. so far this is the script:

Code:
#!/bin/sh

cd /usr/lib/perl5
for d in ./* ; do
    # is it a dir?
    if [ -d $d ]; then
        # yes! get the basename
        cd $d ; dir=`basename $d`
        for f in ./* ; do
            # is it a dir?
            if [ -d $f ]; then
                # yes! get the basename and create it
                ndir=`basename $f` ; mkdir -p /root2/perl-html/$dir/$ndir ; cd $f
                # is there anything in it
                for f2 in ./* ; do
                    #yes! what is it
                    if [ -d $f2 ]; then
                        # its a dir! get the basename and create it
                        ndir=`basename $f2` ; mkdir -p /root2/perl-html/$dir/$ndir ; cd $f2
                        # is there anything in it
                        for f3 in ./*.pm ; do
                            nfile=`basename $f3`; pod2html $nfile >/root2/perl-html/$dir/$ndir/$nfile.html
                        done
                    else
                        nfile=`basename $f2` ; pod2html $nfile >/root2/perl-html/$dir/$nfile.html
                    fi
                    cd ..
                done
            else
                nfile=`basename $f` ; pod2html $nfile >/root2/perl-html/$dir/$nfile.html
            fi
        done
    fi
    cd /usr/lib/perl5
done

# nfile=`basename $f2` ; pod2html $nfile >/root2/perl-html/$dir/$ndir/$nfile.html

It kinda works but the dirs don't get created and some dirs are comming out as .html files... I know iv'e overlooked something so simple but i cant see it ... In need of some jolt me thinks Smilie

Cheers,

Elfyn
elfyn@exposure.org.uk
emcb
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

/usr/lib/32/32-> Question

Hello UNIX people. I was just cruising around my UFS and came across the directory /usr/lib/32. This directory continues up many directories (/usr/lib/32/32/32/32->). Each level of 32/ directory seems to be a copy of the previous one. I have been working with UNIX for a little while now, but I... (3 Replies)
Discussion started by: shaggy
3 Replies

2. UNIX for Advanced & Expert Users

/usr/lib on a seperate partition

I want to move /usr/lib on a seperate partition. ( is is now all at / ) I know how to copy data and update fstab but... At boot time, the mepis distro already needs stuff from /usr/lib but it is not mounted yet. So i get error before /usr/lib is mounted. Does this mean you cannot move... (4 Replies)
Discussion started by: progressdll
4 Replies

3. UNIX for Dummies Questions & Answers

/usr/lib/saf/sac -t 300

pls my server that is running UnixOs solaris is not working properly. it use to display the following errors: INIT:Command is respawning too rapidly. check for possible errors. id: sc "/usr/lib/saf/sac -t 300" what am i suppose to do to correct this problem? Regards. (1 Reply)
Discussion started by: dba
1 Replies

4. UNIX for Dummies Questions & Answers

use of /usr/lib/nsr

Hello, I have this folder on my one of the machine but not on other. /usr/lib/nsr can anyone tell me for what this folder is used ? Thanks (2 Replies)
Discussion started by: yatrik007
2 Replies

5. Solaris

recover a corrupted solaris10 system /usr/lib

did something very dump under /usr/lib, eg: overwite a bunch of files from a similar system's /usr/lib, while the system is live.. I have no backup on this..it crashed...and came up with a bunch of device driver load errors and hung... This is Solaris10 update 7 .. I wonder if I could do a... (0 Replies)
Discussion started by: ppchu99
0 Replies

6. Solaris

Wrong ELF data format: ELFDATA2MSB at /usr/perl5/5.8.4/lib/i86pc-solaris-64int/DynaLoader.pm

We are trying to install our project on solaris 10 x86 machine. we are getting the following error. Can't load '/u01/apps/WatchMark/FlexPM//R39FOA1/sw/perl/lib/auto/DBI/DBI.so' for module DBI: ld.so.1: perl: fatal: /u01/apps/WatchMark/FlexPM//R39FOA1/sw/perl/lib/auto/DBI/DBI.so: wrong ELF data... (3 Replies)
Discussion started by: Jagandadi
3 Replies

7. Solaris

/usr/lib/vhost.so missing Solaris 5.10

Hi, i have a solaris 5.10 machine on which i am getting below error while executing cat command ld.so.1: cat: fatal: vhost.so: open failed: No such file or directory Killed it is related to file vhost.so missing Also when i did ldd cat result is as below libc.so.1... (1 Reply)
Discussion started by: Jcpratap
1 Replies

8. UNIX for Advanced & Expert Users

/usr/lib/libv12n.so

Hi, I want to use the function "v12n_domain_uuid" on solaris box. The library "libv12n" is present in /usr/lib but i can't locate the header "libv12n.h" anywhere in the box. How do i run the API "v12n_domain_uuid" (4 Replies)
Discussion started by: skyineyes
4 Replies

9. BSD

FreeBSD: /usr/bin/ld not looking in /usr/local/lib

I'm not sure if this is the default behavior for the ld command, but it does not seem to be looking in /usr/local/lib for shared libraries. I was trying to compile the latest version of Kanatest from svn. The autorgen.sh script seems to exit without too much trouble: $ ./autogen.sh checking... (2 Replies)
Discussion started by: AntumDeluge
2 Replies

10. Solaris

Cannot open module /usr/lib/security

Dear All After powering on my Netra120 Solaris server and waiting for all of the installed processes to be started , when trying for login I am getting : "can not open module /usr/lib/security/pam_authtok_get.so.1" Can you please let me know what has happened to my server and how can I reach... (3 Replies)
Discussion started by: hadimotamedi
3 Replies
BASENAME(3P)						     POSIX Programmer's Manual						      BASENAME(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
basename -- return the last component of a pathname SYNOPSIS
#include <libgen.h> char *basename(char *path); DESCRIPTION
The basename() function shall take the pathname pointed to by path and return a pointer to the final component of the pathname, deleting any trailing '/' characters. If the string pointed to by path consists entirely of the '/' character, basename() shall return a pointer to the string "/". If the string pointed to by path is exactly "//", it is implementation-defined whether '/' or "//" is returned. If path is a null pointer or points to an empty string, basename() shall return a pointer to the string ".". The basename() function may modify the string pointed to by path, and may return a pointer to internal storage. The returned pointer might be invalidated or the storage might be overwritten by a subsequent call to basename(). The basename() function need not be thread-safe. RETURN VALUE
The basename() function shall return a pointer to the final component of path. ERRORS
No errors are defined. The following sections are informative. EXAMPLES
Using basename() The following program fragment returns a pointer to the value lib, which is the base name of /usr/lib. #include <libgen.h> ... char *name = "/usr/lib"; char *base; base = basename(name); ... Sample Input and Output Strings for basename() In the following table, the input string is the value pointed to by path, and the output string is the return value of the basename() func- tion. +---------------+---------------+ | Input String | Output String | +---------------+---------------+ |"/usr/lib" | "lib" | |"/usr/" | "usr" | |"/" | "/" | |"///" | "/" | |"//usr//lib//" | "lib" | +---------------+---------------+ APPLICATION USAGE
None. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
dirname() The Base Definitions volume of POSIX.1-2008, <libgen.h> The Shell and Utilities volume of POSIX.1-2008, basename COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2013 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Stan- dard is the referee document. The original Standard can be obtained online at http://www.unix.org/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . IEEE
/The Open Group 2013 BASENAME(3P)
All times are GMT -4. The time now is 01:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy