Suppose I need to change the file extensions of certain files in a directory.
#!/bin/bash echo "Please specify a directory: " read folder cd $folder for i in *.txt do mv "$i" `basename $i txt`fasta done
The directory address specified by the user is read into the script in line 2. This address is used to cd to the directory. This script changes the extensions of .txt files to .fasta.