1.
Script to Find the Biggest of 3 Numbers
#!/bin/bash
Big=$1
if [ $2 -gt $Big ]; then
Big=$2
fi
if [ $3 -gt $Big ]; then
Big=$3
fi
echo "Biggest number is $Big"
Run the script like this: ./[Link] 10 25 15
—-----------------------------------------------------------------------------------------------------
2. Script to Convert .txt Files to .py Files in a Directory
#!/bin/bash
echo "Enter the directory name:"
read dir
if [ -d "$dir" ]; then
for file in "$dir"/*.txt; do
[ -e "$file" ] || continue # Skip if no .txt files found
newfile="${file%.txt}.py"
mv "$file" "$newfile"
echo "Renamed $file to $newfile"
done
else
echo "Directory does not exist."
fi
Note: This script renames .txt files to .py in the specified directory.
—--------------------------------------------------------------------------------------------------
3. Script to Check if a File is a Symbolic Link
#!/bin/bash
echo "Enter the file name:"
read file
if [ -L "$file" ]; then
echo "The file is a symbolic link."
else
echo "The file is NOT a symbolic link."
fi
—----------------------------------------------------------------------------------------------------