i need a command that lists the first few lines of files, i want to list the files first and then ask for a file to view
so far i have
#! /bin/bash
cd $1
ls
if [ "$(ls -A $1)" ]; then
read -p "show first few lines of files [y/n] " show
if [[ $show == [y] ]]; then
head -3 *
fi
else
echo "$1 is Empty"
fi
exit
can anyone helpme with my arguments
so far i have
#! /bin/bash
cd $1
ls
if [ "$(ls -A $1)" ]; then
read -p "show first few lines of files [y/n] " show
if [[ $show == [y] ]]; then
head -3 *
fi
else
echo "$1 is Empty"
fi
exit
can anyone helpme with my arguments