Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Dec 1998 02:15:20 -0500 (EST)
From:      "Crist J. Clark" <cjc@cc942873-a.ewndsr1.nj.home.com>
To:        empey@integral.on.ca (David Empey)
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Two Questions
Message-ID:  <199812150715.CAA10678@cc942873-a.ewndsr1.nj.home.com>
In-Reply-To: <199812150423.XAA12491@integral.on.ca> from David Empey at "Dec 14, 98 11:23:59 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
David Empey wrote,
> First, I need to be able to change the extension on a large number of files
> in a directory  from *.txt to *.ltr, but I cannot seem to get the mv (or
> the cp and rm) commands to do the job.  Is there something easier to do
> than renaming the files one by one?

Depends on the shell you are using. If you are using csh or tcsh, type
at the command prompt,

% foreach file ( *.txt )
foreach? mv $file ${file:r}.ltr
foreach? end

Where '%' and 'foreach?' will be the prompts you get. Easy to move
that to a script form. See 'man csh' or the shell of your choice.

> Second, I'm writing a shell script to take input for the 'at' command.
> Using 'read' to get input for the time and day are no problem, but I'm
> having trouble devising a way to get a list of commands to run.  What I
> have in mind is this:  read in variables for time and day, run the at
> command (from a script) with the time and place as arguments.  However,
> what I need is a way to get the script to get a list of commands from the
> user, or else perhaps a way to run the command (from the script) so that it
> gives the user a chance to input a list of commands as would be the case if
> it was run from the command line.
> 
> Any suggestions appreciated, with thanks!

Ummm... It sounds like you are trying to make a command to be a front
end for 'at' that takes the exact same inputs as 'at...' Why not use
'at' in the first place and skip the extra step?
-- 
Crist J. Clark                           cjclark@home.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812150715.CAA10678>