Results 1 to 5 of 5
I'm new to this enviroment and i'm trying to create a script that will produce a text file that has a list of the present working directory. I also have ...
- 03-31-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 2
I'm lost
I'm new to this enviroment and i'm trying to create a script that will produce a text file that has a list of the present working directory. I also have to have it run on auto execution. Does anyone have sugestions? I'm using Cygwin as my text editor.
- 03-31-2009 #2Just Joined!
- Join Date
- Mar 2009
- Posts
- 31
this should work for your script
#!/bin/bash
ls > output.txt
as for running on auto-execution I'm not sure what you mean. You can use a cron job to run the task every so often.
- John
- 04-02-2009 #3Just Joined!
- Join Date
- Mar 2009
- Posts
- 2
O.K. that makes sense but i was told that bashrc will execute the file. How do i save the file and issue chmod and then bashrc?
- 04-02-2009 #4Just Joined!
- Join Date
- Mar 2009
- Posts
- 31
I'm not sure I completely understand your question. If you are asking how to put all of this together I can answer it.
1. Use a text editer to make the script. (i.e nano, pico, vi...)
2. After you save the script issue 'chmod 755 filename'
3. to run the script navigate to the directory where the script is stored and issue './filename' or you can fully qualify the path with '/path/folder/filename'
if you look at the script I posted the top line '#!/bin/bash' tells your program to use bash as it's interpreter. Not sure if that is what you were asking but hopefully it was.
- John
- 04-03-2009 #5Linux Enthusiast
- Join Date
- Aug 2006
- Location
- Portsmouth, UK
- Posts
- 539
Sounds a bit like homework....
Anyway, have a look at the Startup Scripts section on this wikipedia page: Bash - Wikipedia, the free encyclopedia, you'll find reference to bashrc there.Last edited by matonb; 04-03-2009 at 05:07 AM. Reason: Missed a bit ;)
RHCE #100-015-395
Please don't PM me with questions as no reply may offend, that's what the forums are for.


Reply With Quote