LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-20-2008, 10:37 PM   #1
investmentbnker75
Member
 
Registered: Oct 2007
Location: Eastern Seaboard
Distribution: CentOS
Posts: 162

Rep: Reputation: 15
ARGS in bash script


All

I want to define command like what is passed to +mtime and -mtime to whats below. So the command will run as:

script.sh 5 20

the 5 would go to the +mtime and the 20 would go to the -mtime.



#!/bin/sh


find . -type f \( -mtime +$args 1 -o -mtime +$ARGS[1] \)
 
Old 10-21-2008, 01:03 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
The args in shell are $0 ... $9, where $0 is prog name, so $1 is 1st arg.

http://www.ibm.com/developerworks/li...y/l-bash2.html
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html <-- bookmark & read this
 
  


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
processing command args in bash slzckboy Programming 16 10-18-2017 03:12 AM
args or questions in a shell script which is easyer hoodedmanwithsythe Linux - Newbie 25 11-05-2006 05:46 PM
running a command with args from a shell script KM3 Programming 3 10-19-2006 01:46 PM
auto-completion - how does it work & can my script args auto-complete? BrianK Programming 1 06-11-2004 04:51 PM
Bash script; command and args in variable. magjo813 Programming 2 02-16-2004 09:22 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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