Commit 88cb2c09 authored by joubran's avatar joubran

add the second question

parent 04e9a770
THE SECOND QUESTION
joubran-VirtualBox:~ 1225 $ mkdir MyNEWFOLDER
joubran-VirtualBox:~ 1226 $ cd MyNEWFOLDER/
joubran-VirtualBox:~/MyNEWFOLDER 1227 $ touch file{1,2,3,4,5,6,7,8,9,10}_{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}
joubran-VirtualBox:~/MyNEWFOLDER 1229 $ find . -name "*x" -exec sed '1s/ /HelloLinux/g' {} \;
joubran-VirtualBox:~/MyNEWFOLDER 1229 $ cd
joubran-VirtualBox:~ 1230 $ touch creater.sh
joubran-VirtualBox:~ 1231 $ chmod u+x creater.sh
joubran-VirtualBox:~ 1232 $ nano creater.sh
joubran-VirtualBox:~ 1233 $ cat creater.sh
#!/bin/bash
for n in a b c d e f g h i j k l m n o p q r s t u v w x y z ;
do
if [ ! -d "$n" ]; then
mkdir $n
fi
done
joubran-VirtualBox:~ 1234 $ ./creater.sh
joubran-VirtualBox:~ 1235 $ touch mover.sh
joubran-VirtualBox:~ 1236 $ chmod u+x mover.sh
joubran-VirtualBox:~ 1237 $ nano mover.sh
joubran-VirtualBox:~ 1238 $ cat mover.sh
#!/bin/bash
for n in a b c d e f g h i j k l m n o p q r t s u v w x y z ;
do
if [ -d "$/home/joubran/NEWFOLDER/file{1,2,3,4,5,6,7,8,9,10}_$n" ]; then
mv /home/joubran/NEWFOLDER/file{1,2,3,4,5,6,7,8,9,10}_$n /home/joubran/$n
fi
done
joubran-VirtualBox:~ 1239 $ ./mover.sh
joubran-VirtualBox:~ 1240 $ find ./[abcdefghijklmnopqrtsuvwxyz] -name "*[34]*" -exec rm {} \;
joubran-VirtualBox:~ 1241 $ ls
2024-06-24 bin Desktop f it is my name month NEWFOLDER p search_result Videos
2024-06-28 Bin dimasympolic.out fold j mover.sh newww Pictures september w
a c directory folder5 k Music noexis projects t x
a_reports creater.sh Documents g l MyNEWFOLDER november Public Templates y
b d doo h m n o q tmp z
backups dd Downloads ham mansour new october r u
backup-test december e i mkdir newdir operating s v
joubran-VirtualBox:~ 1242 $ cd e
joubran-VirtualBox:~/e 1243 $ ls
file10_e file1_e file2_e file5_e file6_e file7_e file8_e file9_e
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment