How can I display a list of current environment variables and also recognized regular expressions....

Rashkae ubuntu at tigershaunt.com
Thu May 1 19:59:36 UTC 2008


John Toliver wrote:
> I'm looking for the equivalent of the "SET" command in windows.  also if

printenv

> in windows if I typed something like "c:\copy *.* d:\" where can I find
> a list of "*.*" that linux recognizes.  I'm trying to get the basics of
> scripting.  I'm sorry I don't know any more useful ways of describing
> it.

You want cp * /new/destination/

You can use *.*, but that would assume the filenames have a . in them.
Files with no dot (and no 3 letter extension, natually) would not match
*.*  But * matches all files *except* hidden files.  In Unix, 'hidden'
files are those that start with a .  (confused yet?)

So if you want to copy all files in the current directory, including any
that start with a ., try cp . /new/destination/

. on it's own is shell shorthand for current directory.


> 
> Basically if I type cp *.*(what I mean is "all files") source
> destination.
> 
> would these be considered regular expressions? I'm a little hazy on
> this.

Hmm, not really.  The shell expands a few special characters, but it's
only a very small subset of regular expressions.

* matches any string of characters of any length, including 0.

For example, if you had 4 files, named file.txt file1.txt file2.txt
gargabe.txt, then file* would match the first 3.  If you wanted to make
sure you only grabbed the .txt files, you could use file*.txt

? matches any 1 single character.  In the example above, file?.txt would
match file1.txt and file2.txt, but not match file.txt or file11.txt (if
such existed)




More information about the ubuntu-users mailing list