-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfdir_showup.sh
More file actions
28 lines (26 loc) · 960 Bytes
/
fdir_showup.sh
File metadata and controls
28 lines (26 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
arg_1="$1" # args for file/foldername from current directory
: <<'COMMENT'
[[ -z $arg_1 ]] && {
echo -e "\033[1;31mArguments needed to run this script! \033[33meg: $0 <your_FILE/DIRECTORY_name>\033[0m"
} || {
[[ -d $arg_1]] && {
for file in `ls`; do
[[ -f $file ]] && {
echo -e "file name: \033[1;33m$file\033[0m, raw output: \033[1;32m`cat $file`\033[0m\n"
} || {
[[ -f $arg_1 ]] && echo -e "file name: \033[1;33m$arg_1\033[0m, raw output: \033[1;32m`cat $arg_1`\033[0m\n"
}
done
}
COMMENT
if [[ -z $arg_1 ]]; then
echo -e "\033[1;31mArguments needed to run this script! \033[33meg: $0 <your_FILE/DIRECTORY_name>\033[0m"
elif [[ -d $arg_1 ]]; then
for file in `ls`; do
if [[ -f $file ]]; then
echo -e "file name: \033[1;33m$file\033[0m, raw output: \033[1;32m`cat $file`\033[0m\n"
fi
done
elif [[ -f $arg_1 ]];then
echo -e "file name: \033[1;33m$arg_1\033[0m, raw output: \033[1;32m`cat $arg_1`\033[0m\n"
fi