Basic "scripting" (batch file?) question
Eric D.
yellowdog-general@lists.terrasoftsolutions.com
Wed May 22 11:29:00 2002
Hello, I'm trying to delve a little deeper into the workings of Linux. Now I
have two "scripting" questions (more like batch files).
I'm trying to write a batch file that:
(a) creates a folder with a "unique" name (generated by the batch file --
e.g. date+time or random numbers, etc.)
and then
(b) moves files from one (permanent) directory to this (less permanent)
directory.
I used to be able to write simple "batch" files in mach Unix aeons (94) ago
and make them executable (chmod -x?) but haven't been able to figure it out
here (plus, I'd like to remap ls to my execute my own preferred -a and -L).
First of all:
(1) how would I generate a unique name (e.g. date+time)
(2) how would I get that name (uniquename) to be used in the "mkdir
uniquename" and "mv /Permanent/* /uniquename/" commands
(3) how would I make that file "executable" (I thought it was chmod -x or -X
but that doesn't seem to work).
I presume I have to use a string but I don't know how (my programming
experience has been with BASIC & Pascal, and my scripting limited to
recording (and basic editing) of AppleScripts).
So far I have in my "etest" "pico"ed (my favourite *nix editor :) file:
mkdir uniquename
mv Permanent/* uniquename/
So... as you can see I'm lacking the code to create the uniquename & I don't
know how to make it "executable" :( :(
Thanks for your help in advance, Eric.