LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-01-2012, 08:45 PM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 31
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, 09:15 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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 09:18 PM.
 
1 members found this post helpful.
Old 11-02-2012, 01:09 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
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



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

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

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