0
rated 0 times
[
0]
[
0]
/ answers: 1 / hits: 1265
/ 3 Years ago, sat, october 30, 2021, 2:14:02
I encounter an issue running a basic script listing directories.
for item in *
do
if [ -d $item ]
then
echo $item
fi
done
The outcome:
- lists all system folders
- returns an error: for.sh: 4: [: discover: unexpected operator
- lists all my folders, whose names start from a lowercase character
My guess is -d finds some issue with an initial lowercase character?
Can somebody please explain why it happens? Thanks a lot in advance.
More From » bash