The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-02-2009
Hangman2 Hangman2 is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 27
How do I get the name of latest file?

1) How do I get the name of latest file in a variable?

2) Is it safe to delete all files from a dir

I am doing

cd $dir_name

if return_code > 0
rm *
fi

what are other alternates to delete all files from a dir in a shell script?