전체 폴더를 통해 텍스트 파일을 차례로 분할하고 모든 분할 된 청크를 다른 지정된 폴더에 보관하는 셸 스크립트를 만들려고했습니다. 당신이 볼폴더에 텍스트 파일 나누기
#!/bin/bash
#File Split Automation
echo "Usage: split [Folder w/ Input] [Folder For Outputs] [Options] [PREFIX]
Options: -b [sizeMB]: Split by size
-l [No. of Lines]: Split by Lines
If No Output Folder is Defined Default is Set To: /Desktop/splitter-parts
If No Options Are Selected Default is Size=100MB"
inputdirc=$1
outputdirc=$2
spltion=$3
meastick=$4
prefixture=$5
if [ -d $1 ]
then
echo "You Picked The Folder $1 To Split Files From"
ls $1
else
exit
fi
if [ -d $2 ]
then
echo "Please Confirm Folder Path For Output $outputdirc"
else
cd /root/Desktop/
mkdir -p splitter-parts
fi
read -t 10 -p "Press Enter Or Wait 5 Sec. To Continue"
cd $2
for swordfile in $(ls $1);
do
command -p split $3 $4 -a 3 -d $swordfile $5
done
일이 잘못 갈 : 여기
나는 그 아마 투박한 (.sh로를 작성 해본 적이 전에) 알고, 내가 지금까지 가지고 무엇인가? 필자는 원하는 출력을 얻지 못하기 때문에 분할 명령 문자열에 파일과 폴더가있을 때 제대로 작동했지만
EDIT :::
죄송합니다. 사과드립니다. 그냥 나 자신보다 조금 앞서.
이 내가 그것을 실행할 때 내가보고있는 무슨이다 :
지금까지 내가 볼 수 있겠 것과[email protected]:~/Desktop/Wordlists# ./splitter.sh '/root/Desktop/Wordlists' ' /root/Desktop/Untitled Folder' s 100MB
Usage: split [Folder w/ Input] [Folder For Outputs] [Options] [PREFIX]
Options: -b [sizeMB]: Split by size
-l [No. of Lines]: Split by Lines
If No Output Folder is Defined Default is Set To: /Desktop/splitter-parts
If No Options Are Selected Default is Size=100MB
You Picked The Folder /root/Desktop/Wordlists To Split Files From
10dig10milup2.txt mixed.txt
10dig10miluplow2.txt movie-characters.txt
10dig10miluplow3.txt name1s.txt
((------------------CUT------------)
lower.lst xae2.txt
lower.txt xaf2.txt
mangled.lst xag2.txt
mangled.txt xah6.txt
misc-dictionary.txt
./splitter.sh: line 24: [: /root/Desktop/Untitled: binary operator expected
Press Enter Or Wait 5 Sec. To Continue
./splitter.sh: line 37: cd: /root/Desktop/Untitled: No such file or directory
split: extra operand `10dig10milup2.txt'
Try `split --help' for more information.
split: extra operand `10dig10miluplow2.txt'
Try `split --help' for more information.
split: extra operand `10dig10miluplow3.txt'
Try `split --help' for more information.
split: extra operand `10dig10miluplow4.txt'
Try `split --help' for more information.
...................MORE OF THE SAME.......
, 내가 못 했어 멀리 아직 명확하게 나는 몇 가지 단계를 놓친 거지. 일부 메모와 함께
"나는 원하는 출력을 얻지 못했습니다."는 명확한 문제는 아닙니다. 입력과 원하는 결과물을 명확하게 제시하고 문제의 원인을 정확하게 설명하면 더 잘 도와 드릴 수 있습니다. –
스크립트 출력이 맞고 출력이 잘못되었다고 생각할 수 있으십니까? 옳고 그름을 보여주는 예제를 제공하십시오. – Jdamian
왜 사용되지 않는 쉘 변수를 정의합니까? – Jdamian