LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-18-2003, 05:53 PM   #16
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600

i insert in in my script and it DOEST wrk
Just post what you've got?

BTW, "test -z file && exit 1" should read "test -z "$file" && exit 1"
 
Old 11-18-2003, 06:29 PM   #17
glock27linux
LQ Newbie
 
Registered: Nov 2002
Posts: 29

Rep: Reputation: 15
I found www.linuxcommand.org to be a very comfortable introduction to shell scripting with Bash. I would walk thru that tutorial if I were you. It might fill in some spots for you, and perhaps make you more comfortable with looking at advanced tutorials.
 
Old 11-20-2003, 03:49 PM   #18
tiger3
Member
 
Registered: Nov 2003
Location: Land of the Rising Sun!
Distribution: Fedors Core 3, Red Hat 9, Mandrake 8.1
Posts: 52

Rep: Reputation: 15
Exclamation

Try awk! I got this to work for me. It will give you the date/time modified and the file name. To change the info provided just use $1, $2, etc.... for the different fields of the output from the ls command ($1 would be the permissions -rwx--x--x and so on...)

read -p 'Enter filename: ' \file
if [ -f $file ]
then
ls -l $file| awk '{printf "%2d %3s %s\n", $7, $6, $9}'
else
echo $file is not a file
fi

Last edited by tiger3; 11-20-2003 at 03:50 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
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell interface vs shell scripting? I'm confused jcchenz Linux - Software 1 10-26-2005 03:32 PM
Shell Scripting again yaadhav Linux - Newbie 8 08-04-2005 10:21 AM
shell scripting markus1982 Linux - General 2 05-20-2003 07:42 AM
Help with Shell Scripting. eggoz Linux - General 2 04-21-2003 01:15 PM

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

All times are GMT -5. The time now is 07:15 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
Open Source Consulting | Domain Registration