нужно Баш скрипт для отображения файловBash скрипт Shell Script
#!/bin/bash
my_ls() {
# save current directory then cd to "$1"
pushd "$1" >/dev/null
# for each non-hidden (i.e. not starting with .) file/directory...
for file in * ; do
# print file/direcotry name if it really exists...
test -e "$file" && echo "$2$file"
# if directory, go down and list directory contents too
test -d "$file" && my_ls "$file" "$2 "
done
# restore directory
popd >/dev/null
}
my_ls
ожидается выход:
file1
file2
info (directory)
data
stuff (directory)
input
output
scripts (directory)
doit
helper
testinput
jobs
results (directory)
bob
dave
mary
Я предлагаю использовать команду 'find' и переформатировать ее выход. – Jdamian
@Jdamian это именно то, что мне нужно – user4186509
file1, file2, задания - это только файлы, нам нужно отобразить (каталог под каталогами) – user4186509