DATA_DIR=/home/liupan/.navinsight/gm result="" for i in $(ls -a $DATA_DIR) do if [ $i != "." -a $i != ".." ] then result=$result$i"," fi done echo $result
该代码将data_dir下的所有文件夹的名字拼接成以逗号分隔的字符串
时间: 2024-10-10 02:54:25
DATA_DIR=/home/liupan/.navinsight/gm result="" for i in $(ls -a $DATA_DIR) do if [ $i != "." -a $i != ".." ] then result=$result$i"," fi done echo $result
该代码将data_dir下的所有文件夹的名字拼接成以逗号分隔的字符串