LinuxQuestions.org
Visit Jeremy's Blog.
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-01-2012, 09:45 PM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 30
Check data and run script


I would like to write a script to do such thing , if a directory have file that the extension is today (yymmdd), then do a specific action , I will run a cron job to run this script .

for example

oday is 2nd , if the directory have files which file name are abc.121102 and def.121102 , then echo the file name , so the output is abc , def


tomorrow is 3rd , if the directory have files which the file name are xxx.121103 and yyy.121103 , then echo the file name , so the output is xxx , yyy

can advise how to it ?

thanks.
 
Old 11-01-2012, 10:15 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531
Quote:
Originally Posted by ust View Post
write a script
In the approximately nine years you've been with us you've posted over 600 threads and often about scripting. By now you should put in some effort and make it a habit to post what you have come up with without being asked.
TIA

Last edited by unSpawn; 11-01-2012 at 10:18 PM.
 
1 members found this post helpful.
Old 11-02-2012, 02:09 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,952

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by ust View Post
I would like to write a script to do such thing , if a directory have file that the extension is today (yymmdd), then do a specific action , I will run a cron job to run this script .

for example today is 2nd , if the directory have files which file name are abc.121102 and def.121102 , then echo the file name , so the output is abc , def
tomorrow is 3rd , if the directory have files which the file name are xxx.121103 and yyy.121103 , then echo the file name , so the output is xxx , yyy

can advise how to it ?
Yes...read the advice given to you over the past NINE YEARS, and try to actually APPLY THAT KNOWLEDGE AND LEARN SOMETHING
http://www.linuxquestions.org/questi...lp-4175432449/
https://www.linuxquestions.org/quest...er-4175413626/
https://www.linuxquestions.org/quest...te-4175413358/
https://www.linuxquestions.org/quest...column-944377/
https://www.linuxquestions.org/quest...script-946113/

You've been pointed to shell scripting tutorials many, MANY times...you need to actually READ one.
 
  


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
how to check in a bash script where the shell is run from nass Slackware 5 10-24-2012 01:35 AM
Script to run at Boot for Auto Mysql database check Alan87i Linux - Server 6 10-30-2010 05:44 AM
Perl .check if data are exist in the array before adding new data ufmale Programming 12 07-14-2010 06:26 AM
Loop or check SQlite3 database continuously, when query found run script for first 3 Techno Guy Linux - Newbie 3 09-27-2009 08:46 PM
run script to extract data to put to web cghcgh Programming 9 06-10-2008 03:11 AM


All times are GMT -5. The time now is 02:53 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