From 875658414f9cbfd91d53daa102c9354c47354579 Mon Sep 17 00:00:00 2001 From: Aadit Agrawal Date: Fri, 24 Jan 2025 10:04:28 +0530 Subject: [PATCH] Upload files to "OS/bash" --- OS/bash/q1.sh | 7 +++++++ OS/bash/q2.sh | 10 ++++++++++ OS/bash/q3.sh | 26 ++++++++++++++++++++++++++ OS/bash/q4.sh | 24 ++++++++++++++++++++++++ OS/bash/q5.sh | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 105 insertions(+) create mode 100644 OS/bash/q1.sh create mode 100644 OS/bash/q2.sh create mode 100644 OS/bash/q3.sh create mode 100644 OS/bash/q4.sh create mode 100644 OS/bash/q5.sh 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