diff --git a/OS/bash/q1.sh b/OS/bash/q1.sh new file mode 100644 index 0000000..fe5f06d --- /dev/null +++ b/OS/bash/q1.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +echo "Entered file will be copied" + +cp "$1" "duplicate_$1" +echo "File duplicated" + diff --git a/OS/bash/q2.sh b/OS/bash/q2.sh new file mode 100644 index 0000000..c99057c --- /dev/null +++ b/OS/bash/q2.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +echo "Deleteing the following files" + +for file in "$@";do +echo "$file" +rm -i "$file" +done + +echo "All files deleted successfully" diff --git a/OS/bash/q3.sh b/OS/bash/q3.sh new file mode 100644 index 0000000..4f9ac45 --- /dev/null +++ b/OS/bash/q3.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +selection_sort() +{ + local arr=("$@") # array declaration + local n=${#arr[@]} + + for ((i=0; i