LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-24-2005, 12:59 PM   #1
herve2001
Member
 
Registered: Sep 2004
Posts: 34

Rep: Reputation: 15
Shell scripting pros


I'm looking for some help from anyone who knows shell scripting, I'm trying to do the following:

1-Accept a string form the terminal and use case to echo a suitable message if the string doesn't have at least 10 characters.

and

2-Write a script that displays, in head-style, the last three lines of each file in the current directory, duly preceded by the filename.


Thanks.
 
Old 02-24-2005, 01:13 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
1)
Code:
#!/bin/bash

if [ `echo -n $1|wc -m` -lt 10 ];then
 echo Less than 10 chars.
fi
2) tail -vn 3 *
 
Old 02-24-2005, 01:13 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
/me sniffs the air ... "Eeeew, this reeks of homework!"

If this is a homework question, please read the RULES
again that you accepted when you signed up.



Cheers,
Tink
 
  


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
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
Need help from pros in shell scripting? aLiVe Linux - Newbie 18 08-12-2004 09:37 AM
Need help from pros in shell script aLiVe Programming 1 08-08-2004 04:50 AM
Shell Scripting, I think... AMDPwred Linux - General 1 04-06-2002 12:01 AM

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

All times are GMT -5. The time now is 06:56 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration