Home > other >  when the directory name have "*" inside created by linux, it show unreadable character on
when the directory name have "*" inside created by linux, it show unreadable character on

Time:04-10

#!/bin/sh
DOMAINLIST='*.io.domain.fun io.domain.fun *.*.domain.fun'

for i in $DOMAINLIST
do
    mkdir $i
done

This shell code run out unreadable directory name

on my windows 10 . chinese character set

$ dir
_2X68P~X.A   _E2MJ8~X.FUN  

on my linux

# ls -alh .
total 32K
drwxr-xr-x 5 admin administrators 4.0K 2022-04-09 12:33 ./
drwxr-xr-x 6 admin administrators 4.0K 2022-04-09 11:06 ../
drwxr-xr-x 2 admin administrators 4.0K 2022-04-09 12:33 *.io.17lai.fun/
drwxr-xr-x 2 admin administrators 4.0K 2022-04-09 12:33 *.a/

maybe this is a character set problem?

CodePudding user response:

it's probably not a good practice, but you can escape special characters with \ (e.g. mkdir '\*.a')

CodePudding user response:

I know now . Win10 can not have * in file or dir name!

  • Related