Need help with Bash scriting

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

Need help with Bash scriting

Postby NewToBash » Tue Nov 29, 2005 11:30 pm

Hello,

I'm a newbie to Bash. If someone could help me out with this it will be great.

I need to write a script to be able to go through all the directories (contained in home directory) ,names starting with "ms" and for each of such directories found create a new directory inside with the name "msdir"

Also please someone suggest a good website with lots of basic Bash scripts to help me learn how to program.

Thanks
NewToBash
 
Posts: 1
Joined: Tue Nov 29, 2005 11:24 pm

RE: Need help with Bash scriting

Postby RD » Wed Nov 30, 2005 12:11 am

>> Also please someone suggest a good website with lots of basic Bash scripts to help me learn how to program.

Here is the best one i ever used infact its the best one most coders have used enjoy :D
RD
LXF regular
 
Posts: 272
Joined: Mon Jul 25, 2005 2:53 am
Location: irc.ixl2.net

RE: Need help with Bash scriting

Postby nelz » Wed Nov 30, 2005 12:40 am

You don't need a bash script, just the find command
Code: Select all
find ~ -type d -name 'ms*' -exec mkdir -p {}/msdir ';'


See man find for more details.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8469
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK


Return to Programming

Who is online

Users browsing this forum: No registered users and 3 guests