LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-10-2005, 07:45 PM   #1
paraiso
Member
 
Registered: Apr 2005
Distribution: Fedora Core 4
Posts: 88

Rep: Reputation: 15
Question shellScript help


I am trying to create a shellscript which could read files contained in a directory(given as a first argument $1) and then output the result(file path,file name and file type) into a text file which would be formated with header path, name and type. So at the end I have a file with 2 header(path/name, type) and the 2 columns containing the information. I tried this but it doesn't work:

Code:
#!/bin/bash

touch list_file

echo"Path - Name                               Type " > list_file
echo"---------------------------------------------------------------------------" >> list_file


file $1/* | tee test

test | tee -a list_file
Any help is welcome!

Cheers
 
Old 05-10-2005, 08:09 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
I think that using test as a file-name is a silly
idea since it's the name of an actual command ...

If it wasn't, test | would give you a permission
error since the file wouldn't be executable.


Cheers,
Tink
 
Old 05-10-2005, 08:09 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
duh ... :)

Clicked quote instead of edit ...

Last edited by Tinkster; 05-10-2005 at 08:10 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Shellscript paraiso Linux - Newbie 7 05-12-2005 08:25 AM
Lockscreen Shellscript 2 paraiso Linux - General 1 05-11-2005 06:30 PM
Table format with ShellScript paraiso Linux - General 2 05-11-2005 07:39 AM
LS and shellscript - I'm stuck MikeHunt79 Linux - Software 2 03-11-2005 05:44 AM
ShellScript sharadgana Programming 1 12-16-2004 02:16 PM


All times are GMT -5. The time now is 06:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration