#!/bin/bash # Function to display current directory and files display_files_and_head() { local files files=$(ls -1 | pr -o 2 -l 1 -w $(tput cols)) echo "Current Directory: $(pwd)" echo "Files:" echo "$files" | cut -f1 echo "Selected file:" local file=$1 if [[ -f "$file" ]]; then head -n 5 $file else echo "Invalid file" fi } # Main loop while true; do # Clear screen clear # Display current time date +"%T" # Display files and head of selected file display_files_and_head read -p "Enter a file to view head: " file display_files_and_head $file # Handle user input read -p "Enter command (up, left, right, grep, copy, move, rename, nano, shell): " cmd case $cmd in "up") cd .. ;; "left") cd .. ;; "right") read -p "Enter directory to go into: " dir cd $dir ;; "grep") read -p "Enter search string: " search grep -r $search . ;; "copy") read -p "Enter file to copy: " file read -p "Enter destination: " dest cp $file $dest ;; "move") read -p "Enter file to move: " file read -p "Enter destination: " dest mv $file $dest ;; "rename") read -p "Enter file to rename: " file read -p "Enter new name: " newname mv $file $newname ;; "nano") read -p "Enter file to edit: " file nano $file ;; "shell") read -p "Enter command: " command eval $command ;; esac done