GIDForums  

Go Back   GIDForums > Computer Forums > Computer Software Forum - Linux
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 09-Dec-2008, 23:26
nilusha6 nilusha6 is offline
New Member
 
Join Date: Aug 2008
Posts: 12
nilusha6 is an unknown quantity at this point
Unhappy

Shell scripting


HI,
im new to shell scripting.
I jst want to write a script to rename the filenames, in a given folder.

I seaced for a way, and found 'sed' command.

nw i want to pass the folder name to the script.

I dnt hv any idea about,passing values to script.
Can anyone help me.

Thnak u.
  #2  
Old 10-Dec-2008, 08:03
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 5,310
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: C shell scripting


Quote:
Originally Posted by nilusha6
...I seached[/color]ced ...Can anyone help me.
If you are using Bash, then I suggest that you search for a Bash Tutorial. I always go to the Mother Lode http://tldp.org/. See Footnotes.

Here you can find Bash Programming - Introduction and Advanced Bash-Scripting Guide

Using a couple of things gleaned from the HOWTO, here is a bash shell that runs on my Linux systems:

Code:
# showargs.sh: Bash script to show arguments count=0 for i in $* do count=$((count + 1)) echo "Argument number $count: $1" shift done echo echo "Number of arguments = $count"

A couple of runs, from a Bash shell:

Code:
$ ./showargs.sh Number of arguments = 0 $

Code:
$ ./showargs.sh This is a test Argument number 1: This Argument number 2: is Argument number 3: a Argument number 4: test Number of arguments = 4 $

Regards,

Dave

Footnotes:

1. If you are using some other shell (tcsh, ksh, sh (the original UNIX Bourne shell), or whatever), then you can search for tutorials on that one. When asking a question that is not about standard C or C++, you should always give full information (what Operating System, for example).

2. If you read through the HOWTO, you can even find an example of a File re-namer script

3. This doesn't really belong in a C programming forum since it has nothing to do with the C language. If you are using Linux, maybe it should be posted on the "Computer Software Forum - Linux" part of gidforums. If something else, then, maybe on the "Miscellaneous Programming" part. (I assume that you are not using the Microsoft cmd.exe shell, but if you are, then you can post on the "Computer Software Forum - Windows" part.)
Last edited by davekw7x : 10-Dec-2008 at 08:43.
  #3  
Old 10-Dec-2008, 08:47
nilusha6 nilusha6 is offline
New Member
 
Join Date: Aug 2008
Posts: 12
nilusha6 is an unknown quantity at this point

Re: C shell scripting


HI ,
thank u so much.
Actually it was a mistak that i used c forum.
Normally,i used this site for C problems,an accidently i had used this time also.

btw,Im using LINUX environment and tryn to get basic knowledge about shell scripting.

Btw,thank uso much 4 ur guidence.

Regards,
Nilusha.
  #4  
Old 10-Dec-2008, 17:40
nilusha6 nilusha6 is offline
New Member
 
Join Date: Aug 2008
Posts: 12
nilusha6 is an unknown quantity at this point

Re: Shell scripting


Hi,
I want to pass a folder name to the script,and want to get the content files one by one.

How should I expand the folder contents and look for a files?

Can anyone help me plz.
 
 

Recent GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help supporting linux pipes in a C shell program student28 C Programming Language 4 28-Nov-2007 09:28
Shell program ajohn Computer Software Forum - Linux 13 16-Oct-2007 10:31
scripting language sai krishna Web Design Forum 4 23-Dec-2006 12:53
problem with system() and win32 shell lordfuoco C++ Forum 0 27-Jun-2006 03:09
Call a C program through Linux shell script nuwandee C Programming Language 3 29-Mar-2004 21:54

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 11:33.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.