Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 07-22-2004, 05:28 PM   #1
LQ Newbie
Registered: Jul 2004
Location: Chicago USA
Distribution: Slackware 10.0
Posts: 6

Rep: Reputation: 0
Specifying target directory for command in bash shell script?

hi guys,
so i'm attempting to do some shell scripting using bash, and i'm stuck on one little thing - i've got a certain command i want to run in the script, but i need to specify the directory to run the command on, and i don't know how to do that. now the details:

in the command line, i would just run the command:
ls *jpg *JPG *AVI *avi >

while in the directory i want to run it on. it looks at the current directory, finds all the files of the specified type, and prints their names to a file. that works.

BUT...i want to put the command into a script, and the script will be running from a different directory. so basically, how do i make this specific line of code run on a directory other than the one the script's in?

thanx in advance.

Last edited by spectrescape; 07-22-2004 at 05:31 PM.
Old 07-22-2004, 05:37 PM   #2
LQ Newbie
Registered: Jul 2004
Location: Chicago USA
Distribution: Slackware 10.0
Posts: 6

Original Poster
Rep: Reputation: 0
HA - solved it like 5 minutes after that post by (what else) reading the man page!

RTFM strikes again...


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
help with bash shell script !! taiwf Linux - Newbie 5 06-11-2006 06:07 PM
Shell: Tar files: programmatically determining the name of the target directory stefanlasiewski Programming 3 08-17-2005 08:48 PM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
shell script: delete all directories named directory.# except directory.N brian0918 Programming 3 07-13-2005 06:54 PM
how do i chage the color of a file or a directory in a bash shell Paxmaster Linux - Software 3 10-17-2004 11:21 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:12 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration