LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 06: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, 07:09 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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, 07:09 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
duh ... :)

Clicked quote instead of edit ...

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


Reply



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 07:25 AM
Lockscreen Shellscript 2 paraiso Linux - General 1 05-11-2005 05:30 PM
Table format with ShellScript paraiso Linux - General 2 05-11-2005 06:39 AM
LS and shellscript - I'm stuck MikeHunt79 Linux - Software 2 03-11-2005 04:44 AM
ShellScript sharadgana Programming 1 12-16-2004 01:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:20 AM.

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
Open Source Consulting | Domain Registration