This is a discussion on Need help with printing arrary in Ksh within the Shell scripting forums, part of the Development/Scripting category; Hi, I am trying to (echo ls -l $i) but it's not printing if someone can help me....I am trying ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
Hi,
I am trying to (echo ls -l $i) but it's not printing if someone can help me....I am trying to ls -l everything in the arrary....Thanks in advance script: #/usr/bin/ksh typeset -i cnt=0 while read line do myarray[$cnt]=$line ((cnt = cnt + 1)) done < myfile for i in ${myarray[*]i}; do echo `ls -l $i` done data file myfile: /usr/share/man/sman3ldap /usr/share/man/sman3xfn /usr/share/ds5/manual/en/slapd/schema /usr/share/audio/samples/au /usr/share/audio/samples /usr/share/audio /usr/share/admserv5.1/manual/en/admin/ag/graphics /usr/share/lib/zoneinfo /usr/share/man/man1 /usr/share/man/sman3thr |
| Sponsored Links | ||
|
|
|
||||
|
Hmm
I executed your script and it run without problem. It mean no error in script. Okay lets see if your path #/usr/bin/ksh is correct or not as I'm on Linux rignt now my path is #/bin/ksh Try to add Code:
set -x
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
|
|||
|
Hello avcert,
can u pls let me know, what is your script used for. I am new and want to know what can I use it for. Rocky, Even if u can help, pls, I want to know. I will appreciate it if you can disect what each line does. As you know, I am really very new. Thanks, rc |
|
|||
|
Rocky,
I figured out what is going on. I was getting very large output. The reason is because some of the files in the data file were directories and I did not realize that. I have removed the directories from the data file and it works fine. Thanks. The scripts is supposed to read each line from the file "myfile" and do a "ls -l" on each file..... |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| printing file in perl | chandanperl | Coding in General | 3 | 04-16-2008 11:03 AM |
| Cups is not printing text file with proper format, staircasing issue | Ashish Pathak | CentOS / RHEL / Fedora | 1 | 11-18-2007 08:12 AM |
| Linux java apps: printing | mike herdman | Linux software | 7 | 01-15-2007 01:06 PM |