Reputation: 33
I want to get all the filename into a variable in a path so that I could list all the files inside it no matter what type they are.
As of now If there is a directory inside the file or a folder then its name should be displayed not its content
#!/bin/sh
echo Hello World
for file in /C:/Users/shubham.tomar/Desktop/Shell/Test1/*
do
echo inside loop
filename=$(basename "$file")
echo File -> $filename
done
Output:
Hello World
inside loop
demo.sh: line 8: $filename: ambiguous redirect
Upvotes: 0
Views: 326