#!/bin/bash #set folder variable folder="files" #check if folder exists, if not create it [ -a "$folder" ] && echo "$folder exists" || mkdir "$folder" move(){ if [ "$2" != "true" ] #only echo output if '-q' is not set then echo "Moving $1 for ${folder}..." fi mv $1 "$folder" } copy(){ if [ "$2" != "true" ] #only echo output if '-q' is not set then echo "Copying $1 for ${folder}..." fi cp $1 "$folder" } for var in "$@" do if [ "$var" = "-f" ] then force="true" #if '-f' is set then we are going to move files elif [ "$var" = "-q" ] then quiet="true" #if '-q' is set then be quiet fi done #loop through all files for file in * do if [ "$force" = "true" ] # if '-f' is set then move then move "$file" "$quiet" else #if '-f' is not set copy copy "$file" "$quiet" fi done