This repository has been archived by the owner on Feb 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstartlearning
executable file
·852 lines (649 loc) · 25 KB
/
startlearning
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
#!/usr/bin/env bash
#uncomment the following command for debug mode
#set -x
#<---arguments-input-defined--->
args="$@"
comand="startlearning ${args}"
PWD=$(pwd)
#<<<----------colour substitution by variables---------->>>
B0="$(printf '\033[100m')" S0="$(printf '\033[30m')"
B1="$(printf '\033[91m')" S1="$(printf '\033[31m')"
B2="$(printf '\033[92m')" S2="$(printf '\033[32m')"
B3="$(printf '\033[93m')" S3="$(printf '\033[33m')"
B4="$(printf '\033[94m')" S4="$(printf '\033[34m')"
B5="$(printf '\033[95m')" S5="$(printf '\033[35m')"
B6="$(printf '\033[96m')" S6="$(printf '\033[36m')"
B7="$(printf '\033[97m')" S7="$(printf '\033[37m')"
R1="$(printf '\033[0;1m')" R0="$(printf '\033[00m')"
#<<<-----------special colours----------->>>
T="$(printf '\033[5;1;32m')"
#<<<----------Variables declaration---------->>>
OS=$(uname -o)
distro=$(pwd)
exit_on_signal_SIGINT () {
echo "${S1} [✗] Received INTR call - Exiting...${R0}"
# exit 0
return 1
}
trap exit_on_signal_SIGINT SIGINT
#<<<----------Requirements---------->>>
case ${OS} in
Android)
pkg=(python pv sox)
for i in "${pkg[@]}"
do
sleep 0.3
if ! hash "${i}" 2>/dev/null;then
echo -e "${R1}Installing ${i}"
pkg install "${i}" -y
fi
done
;;
GNU/Linux)
pkg=(pv sox)
os="$(source /etc/os-release && echo "${ID}" )"
case "${os}" in
arch|archarm|arcolinux|artix|manjaro|garuda|predator|endeavouros)
pm="sudo pacman -Syu --noconfirm"
;;
debian|ubuntu|linuxmint|kali|parrot|raspbian)
pm="sudo apt install -y"
;;
fedora)
pm="sudo dnf install -y"
;;
freebsd)
pm="sudo pkg install -y"
;;
gentoo)
pm="sudo emerge --ask"
;;
void)
pm="sudo xbps-install"
;;
puppy_fossapup64)
pm="sudo pkg g"
;;
nixos)
pm="nix-env -iA nixos."
;;
solus)
pm="eopkg install -y"
;;
*)
echo -e $RED "Sorry... this is sadly not a supported distro!"
exit 0
;;
esac
for i in "${pkg[@]}"
do
sleep 0.3
if ! hash "${i}" 2>/dev/null;then
echo -e "${R1}Installing ${i}"
${pm} "${i}"
fi
done
! hash python3 && echo "install python and install lolcat from pip."
;;
*)
printf "${S2}[${S1}!${S2}]${S1} Unsupported operating system detected!!${R0}\n"
exit 1
;;
esac
echo
printf "${S5}Requirements installed!!${R0}\n" | pv -qL 100
echo
#<<<----some functions---->>>
wait() {
sleep 0.02
}
__ENTER__() {
echo
printf "Press enter key to continue${T}__\e[0;0;0m"
read ENTER
echo
}
__chapter1__() {
printf "${S6}LETS START OUR BASH LEARNING ;)${R0}\n"
echo
echo -e " ${B4} ${S2}CHAPTER:- 1 ${R0} ${R1}"
echo
echo -e "
Bash is an acronym of “Bourne-Again Shell”. It is a
default command-line interpreter for UNIX and Linux
based operating systems. In UNIX and Linux based operating
systems, a terminal window is consist of a shell and Bash.
" | pv -qL 1000 | lolcat
play assets/chapter_1/ch_1pr_1.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
first of all we will learn basic commands! so lets go...
" | pv -qL 1000 | lolcat
echo -e "
First command is 'echo' or 'printf'
We use any of these to command to print anything on the screen.
examples:-
" | pv -qL 1000 | lolcat
echo '#1) echo "hello world"' | pv -qL 1000 | lolcat
echo -e "
result==> hello world
" | pv -qL 1000 | lolcat
echo '#2) printf "hello world\n"' | pv -qL 1000 | lolcat
echo -e "
result==> hello world
" | pv -qL 1000 | lolcat
echo '# note in printf we used (\n) to go to next line so that other next objects must be printed on next line! but in echo we do not need to do so.' | pv -qL 1000 | lolcat
play assets/chapter_1/ch_1pr_2.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
if you want to make a script for printing your desired thing, then lets have an example for that!! ;)
first of all you have to open any text editor for example :- 'nano', 'vim', 'neovim', etc.
since you are a beginer then you must try with nano;
choose a name for your script (say, test1)
then open nano by 'nano test1'
here you have to define the language which you are going to write (here its 'bash')
in first line have to write '#!/bin/bash'
you may noticing '#!' that what is this?!!
=> '#!' is called shebang. In computing, a shebang is the character sequence consisting of the characters number sign and exclamation mark at the beginning of a script. It is also called sha-bang, hashbang, pound-bang, or hash-pling.
" | pv -qL 1000 | lolcat
play assets/chapter_1/ch_1pr_3.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
After this from second line you can write your codes ;)
example:-
#!/bin/bash
echo \"hello world\"
echo #<- this blank echo is used to make one line gap!" | pv -qL 1000 | lolcat
echo 'printf "hello world\n"' | pv -qL 1000 | lolcat
echo -e "
#After writing all your codes you need to save then!
command to save :- CTRL + X
then it will ask you if you want to save or not, just press y and then Enter key!
NOW, in order to run it you have to give it execution permission by:- chmod +x test1
of your script name is different then you just have to replace test1 by your script name! :)
now it time to run it!!
you have two ways to run it :-
1> ./test1
2> bash test1
then it will run your script :)
" | pv -qL 1000 | lolcat
play assets/chapter_1/ch_1pr_4.mp3 > /dev/null 2>&1
echo -e "
result:-
hello world
<----there is a gap because be have used a blank echo in our script
hello world
" | pv -qL 1000 | lolcat
play assets/chapter_1/ch_1pr_5.mp3 > /dev/null 2>&1
__ENTER__
}
__chapter2__() {
echo -e " ${B4} ${S2}CHAPTER:- 2 ${R0} ${R1}"
echo
echo -e "
In the previous chapter we have leant how to make a simple bash script.
Now its time to learn some more basic commands or syntaxes to use in our
script to make it awesome :)!
" | pv -qL 1000 | lolcat
play assets/chapter_2/ch_2pr_1.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
Quick note: Anything encased in [ ] means that it’s optional.
Some commands can be used without options or specifying files.
ls — List directory contents
ls is probably the most common command.
A lot of times, you’ll be working in a directory
and you’ll need to know what files are located there.
The ls command allows you to quickly view all files
within the specified directory.
Syntax: ls [option(s)] [file(s)]
Common options: -a, -l
" | pv -qL 1000 | lolcat
play assets/chapter_2/ch_2pr_2.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
echo — Prints text to the terminal window
echo prints text to the terminal window and is
typically used in shell scripts and batch files
to output status text to the screen or a computer file.
Echo is also particularly useful for showing the values of
environmental variables, which tell the shell how to behave
as a user works at the command line or in scripts.
Syntax: echo [option(s)] [string(s)]
Common options: -e, -n
" | pv -qL 1000 | lolcat
play assets/chapter_2/ch_2pr_3.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
touch — Creates a file
touch is going to be the easiest way to create new files,
but it can also be used to change timestamps on files and/or directories.
You can create as many files as you want in a single command without worrying
about overwriting files with the same name.
Syntax: touch [option(s)] file_name(s)
Common options: -a, -m, -r, -d
#To create multiple files:-
example:-
touch test1 test2 test3 test4
result :- it will create all files that you supposed
to be created. i.e test1, test2, test3, test4
" | pv -qL 1000 | lolcat
play assets/chapter_2/ch_2pr_4.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
mkdir — Create a directory
mkdir is a useful command you can use to create directories.
Any number of directories can be created simultaneously which
can greatly speed up the process.
Syntax: mkdir [option(s)] directory_name(s)
Common options: -m, -p, -v
#To create directories under directry
example:-
mkdir -p test/test1/test2/test3
result :- it has created a directory named test3 inside
test2 which is inside test1 which is also inside the test directory
" | pv -qL 1000 | lolcat
play assets/chapter_2/ch_2pr_5.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
grep — search
grep is used to search text for patterns specified by the user.
It is one of the most useful and powerful commands. There are
often scenarios where you’ll be tasked to find a particular string
or pattern within a file, but you don’t know where to start looking,
that is where grep is extremely useful.
Syntax: grep [option(s)] pattern [file(s)]
Common options: -i, -c, -n , -o
example:-
uname -o | grep 'Android'
result:- Android #for android users
result:- #for other users its vacant or we can say null.
" | pv -qL 1000 | lolcat
play assets/chapter_2/ch_2pr_6.mp3 > /dev/null 2>&1
__ENTER__
}
__chapter3__() {
echo -e " ${B4} ${S2}CHAPTER:- 3 ${R0} ${R1}"
echo
echo -e "
${S6}In this chapter we will learn our next basic command. So let's start!!${R0}
" | pv -qL 1000
play assets/chapter_3/ch_3pr_1.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
man — Print manual or get help for a command
The man command is your manual and is very useful when you
need to figure out what a command does. For example, if you
didn’t know what the command rmdir does, you could use the
man command to find that out.
Syntax: man [option(s)] keyword(s)
Common options: -w, -f, -b
" | pv -qL 1000 | lolcat
play assets/chapter_3/ch_3pr_2.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
cd — Change directory
cd will change the directory you’re in so that you can get
info, manipulate, read, etc. the different files and
directories in your system.
Syntax: cd directory
" | pv -qL 1000 | lolcat
play assets/chapter_3/ch_3pr_3.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
pwd — Print working directory
pwd is used to print the current directory you’re in.
As an example, if you have multiple terminals going and
you need to remember the exact directory you’re working
within, then pwd will tell you.
Syntax: pwd
example :- pwd #in home directory of termux
result:- /data/data/com.termux/files/home
" | pv -qL 1000 | lolcat
play assets/chapter_3/ch_3pr_4.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
mv — Move or rename directory
mv is used to move or rename directories. Without
this command, you would have to individually rename
each file which is tedious. mv allows you to do batch
file renaming which can save you loads of time.
Syntax: mv [option(s)] argument(s)
Common options: -i, -b, -v
example:- to move file from curren directory to home directory
mv -v test \$HOME #\$HOME is path of home directory
example:- to rename a file
mv test test1
" | pv -qL 1000 | lolcat
play assets/chapter_3/ch_3pr_5.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
rmdir — Remove directory
rmdir will remove empty directories. This can help clean
up space on your computer and keep files and folders organized.
It’s important to note that there are two ways to remove
directories: rm and rmdir.
The distinction between the two is that rmdir will only
delete empty directories, whereas rm will remove directories and
files regardless if they contain data or not.
Syntax: rmdir [option(s)] directory_names
or rm [option(s)] directory or file name
Common options: -p, -f, -rf
example:- rmdir test #it will delete test directory if it is empty
rm -rf test #it will forcely delete the directory or
file whether it is empty or not
" | pv -qL 1000 | lolcat
play assets/chapter_3/ch_3pr_6.mp3 > /dev/null 2>&1
__ENTER__
}
__chapter4__() {
echo -e " ${B4} ${S2}CHAPTER:- 4 ${R0} ${R1}"
echo
echo -e "
${S6}In this chapter we will learn some advanced command. So let's start!!${R0}
" | pv -qL 1000
play assets/chapter_4/ch_4pr_1.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
locate — Locate a specific file or directory
This is by far the simplest way to find a file or directory.
You can keep your search broad if you don’t know what exactly it is
you’re looking for, or you can narrow the scope by using wildcards
or regular expressions.
Syntax: locate [option(s)] file_name(s)
Common options: -q, -n, -i
Exit Status: This command will exit with status 0 if any specified match found.
If no match founds or a fatal error encountered, then it will exit with
status 1. In future chapters we will learn how to use these exit status for
doing proper thing in a script. Till then just remember that, if, any command
runs successfully then it will exit with status 0.
" | pv -qL 1000 | lolcat
play assets/chapter_4/ch_4pr_2.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
less — view the contents of a text file
The less command allows you to view files without opening an editor.
It’s faster to use, and there’s no chance of you inadvertently
modifying the file.
Syntax: less file_name
Common options: -e, -f, -n
To exit less just press these keys combination:- 'esc' + ':' + 'q'
" | pv -qL 1000 | lolcat
play assets/chapter_4/ch_4pr_3.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
compgen — Shows all available commands, aliases, and functions
compgen is a handy command when you need to reference all
available commands, aliases, and functions.
Syntax: compgen [option(s)]
Common options: -a, -c, -d
" | pv -qL 1000 | lolcat
play assets/chapter_4/ch_4pr_4.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
> — redirect stdout
The > character is the redirect operator. This takes the output
from the preceding command that you’d normally see in the terminal
and sends it to a file that you give it. As an example, take
echo “contents of file1” > file1.
Here it creates a file called file1 and puts the echoed string into it.
Note:- if you use this > character to put your objects in a particular file,
it will erase the previously written things in that file if found something!!
so, if you don't want to erase previous things just use > this character
two times i.e >>
example:-
echo \"my name is BHUTUU\" > test1
result:- It will write 'my name is BHUTUU' in test1 file
now let's write something more in the same file
echo \"I love BHUTUU\" > test1
result:- It will erase the previous line and write 'I love BHUTUU' in that file
if we had done it in following after writing first line:-
echo \"I love BHUTUU\" >> test1
result:- It would have kept the previous line as usual and also write
'I love BHUTUU' in the next line.
Syntax: >
Common options: n/a
" pv -qL 1000 | lolcat
play assets/chapter_4/ch_4pr_5.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
cat — Read a file, create a file, and concatenate files
cat is one of the more versatile commands and serves three main
functions: displaying them, combining copies of them, and
creating new ones.
Syntax: cat [option(s)] [file_name(s)] [-] [file_name(s)]
Common options: -n, -E, -s, -v, -A
examples:-
#1) To view a single file:->
Command:- cat filename
Output:- It will show content of given filename
#2) To view multiple files:->
Command:- cat file1 file2
Output:- This will show the content of file1 and file2.
#3) To view contents of a file preceding with line numbers:->
Command:- cat -n filename
Output:- It will show content with line number
example:- cat -n BHUTUU.txt
1)This is BHUTUU
2)A unique array
#4) Create a file:->
Command:- cat >newfile
Output:- Will create and a file named newfile
" | pv -qL 1000 | lolcat
play assets/chapter_4/ch_4pr_6.1.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
#5) Copy the contents of one file to another file:->
Command:- cat [filename-whose-contents-is-to-be-copied] > [destination-filename]
Output:- The content will be copied in destination file
#6) Cat command can suppress repeated empty lines in output:->
Command:- cat -s BHUTUU.txt
Output:- Will suppress repeated empty lines in output
#7) Cat command can append the contents of one file to the end of another file:->
Command:- cat file1 >> file2
Output:- Will append the contents of one file to the end of another file
#8) Cat command can display content in reverse order using tac command:->
Command:- tac filename
Output:- Will display content in reverse order
#9) Cat command can highlight the end of line:->
Command:- cat -E \"filename\"
Output:- Will highlight the end of line
#10) If you want to use the -v, -E and -T option together,
then instead of writing -vET in the command, you can
just use the -A command line option->
Command:- cat -A \"filename\"
#11) Cat command to open dashed files:->
Command:- cat -- \"-dashfile\"
Output:- Will display the content of -dashfile
#12) Cat command if the file has a lot of content and can’t fit in the terminal:->
Command:-cat \"filename\" | more
Output:- Will show that much content, which could fit in terminal and will ask to show more.
#13) Cat command to merge the contents of multiple files:->
Command:- cat \"filename1\" \"filename2\" \"filename3\" > \"merged_filename\"
Output:- Will merge the contents of file in respective order and will insert that content in \"merged_filename\"
#14) Cat command to display the content of all text files in the folder:->
Command:-cat *.txt
Output:- Will show the content of all text files present in the folder.
#15) Cat command to write in an already existing file:->
Command:- cat >> BHUTUU.txt
The newly added text.
Output:- Will append the text \"The newly added text.\" to the end of the file.
" | pv -qL 1000 | lolcat
play assets/chapter_4/ch_4pr_6.2.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
Let's see one more example:-
cat <<- VAR > \${HOME}/BHUTUU.txt
hello my name is Suman kumar ~BHUTUU.
I love BHUTUU.
I love to make automation programs.
VAR
result:- It will write the following in BHUTUU.txt file in home directory:-
hello my name is Suman kumar ~BHUTUU.
I love BHUTUU.
I love to make automation programs.
NOTE:-
#you can use '>>' in place of '>' for declaring path and file name of the output
as you already knew the diffrence between the result of '>' and '>>' .!
#you can write any variable in place of 'VAR'. It is here used to set the
starting and ending point of the objects to be written in the output file.
" | pv -qL 1000 | lolcat
play assets/chapter_4/ch_4pr_6.3.mp3 > /dev/null 2>&1
__ENTER__
}
__chapter5__() {
echo -e " ${B4} ${S2}CHAPTER:- 5 ${R0} ${R1}"
echo
echo -e "
In this chapter we are going to learn some more useful linux commands! so let's get started
" | pv -qL 1000 | lolcat
play assets/chapter_5/ch_5pr_1.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
| — Pipe
A pipe takes the standard output of one command
and passes it as the input to another.
Syntax: |
Common options: n/a
For example:-
echo \"hello\" | grep -o \"o\"
Result:- o
" | pv -qL 1000 | lolcat
play assets/chapter_5/ch_5pr_2.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
head — Read the start of a file
By default, the head command displays the first
10 lines of a file. There are times when you may
need to quickly look at a few lines in a file and
head allows you to do that. A typical example of
when you’d want to use head is when you need to
analyze logs or text files that change frequently.
Syntax: head [option(s)] file(s)
Common options: -n
" | pv -qL 1000 | lolcat
play assets/chapter_5/ch_5pr_3.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
tail — Read the end of a file
By default, the tail command displays the last
10 lines of a file. There are times when you may
need to quickly look at a few lines in a file and
tail allows you to do that. A typical example of
when you’d want to use tail is when you need to
analyze logs or text files that change frequently.
Syntax: tail [option(s)] file_names
Common options: -n
" | pv -qL 1000 | lolcat
play assets/chapter_5/ch_5pr_4.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
chmod — Sets the file permissions flag on a file or folder
There are situations that you’ll come across where you
or a colleague will try to upload a file or modify a
document and you receive an error because you don’t
have access. The quick fix for this is to use chmod.
Permissions can be set with either alphanumeric characters
(u, g, o) and can be assigned their access with w, r, x.
Conversely, you can also use octal numbers (0-7) to change the
permissions. For example, chmod 777 my_file will give access to
everyone.
Syntax: chmod [option(s)] permissions file_name
Common options: -f, -v
" | pv -qL 1000 | lolcat
play assets/chapter_5/ch_5pr_5.mp3 > /dev/null 2>&1
__ENTER__
echo -e "
exit — Exit out of a directory
The exit command will close a terminal window, end the execution
of a shell script, or log you out of an SSH remote access session.
Syntax: exit
Common options: n/a
" | pv -qL 1000 | lolcat
play assets/chapter_5/ch_5pr_6.mp3 > /dev/null 2>&1
__ENTER__
}
if [[ ${comand} == 'startlearning -2' ]]; then
chap=(2 3 4)
for i in ${chap[@]}; do
__chapter${i}__
done
elif [[ ${comand} == 'startlearning -3' ]]; then
chap=(3 4)
for i in ${chap[@]}; do
__chapter${i}__
done
elif [[ ${comand} == 'startlearning -4' ]]; then
chap=(4)
for i in ${chap[@]}; do
__chapter${i}__
done
elif [[ ${comand} == 'startlearning -5' ]]; then
chap=(5 6)
for i in ${chap[@]}; do
__chapter${i}__
done
#elif [[ ${comand} == 'startlearning -6' ]]; then
#chap=(6)
#for i in ${chap[@]}; do
#__chapter${i}__
#done
elif [[ ${comand} == 'startlearning -u' || ${comand} == 'startlearning --update' ]]; then
git pull
exit 1
elif [[ ${comand} == 'startlearning -h' || ${comand} == 'startlearning --help' ]]; then
printf " \e[1;37m /\ .__ ._ _ _ .__|_ _._|_o _ ._ __ |_ _ |._ ._ _ _ ._ _\e[0m\n"
printf " \e[1;33m/--\|(_||_|| | |(/_| ||_(_| |_|(_)| | | |(/_||_) | | |(/_| ||_|(/_\e[0m\n"
printf " \e[1;31m _| |\e[0m\n"
echo
echo -e "
${S5}<${S1}=========${S2}ARGUMENTS${S1}=======================${S2}USAGE${S1}=====================================${S5}>${R0}
${S6} -h ${S7}OR ${S6}--help ${S4}To show this argumentation help menue${R0}
${S6} -u ${S7}OR ${S6}--update ${S4}To update ! :)${R0}
${S6} -c ${S7}OR ${S6}--content ${S4}To show the list of chapters in this program!${R0}
${S5}<${S1}----${S2}x${S1}----${S5}>${R0}
${S7}IF you want to open any particular chapter and continue from there then do:-${R0}
${S2} ./startlearning -chapeter_number${R0}
${S6}example:-${R0}
${S2} ./startlearning -3${R0}
${S4}This will start from chapter 3 and continue${R0}
${S2}>>> ${S6}To run this program just run${R0} ${B5} './startlearning' ${R1}
${S5}<${S1}----${S2}x${S1}----${S5}>${R0}
${S3}To exit program just do ${S3}${B7} ctrl + c ${R1}
${S5}<${S1}----${S2}x${S1}----${S5}>${R0}
"
elif [[ ${comand} == 'startlearning -c' || ${comand} == 'startlearning --content' || ${comand} == 'startlearning --chapter' || ${comand} == 'startlearning --list' ]]; then
echo -e "
${B4}${T2}SL. NO${R0}${R1} ${B4}${T2} Chapter Name and discription.${R0}${R1}
${S6}1. Introduction to bash scripting${R0}
${S3} *definition of bash${R0}
${S3} *Introduction to printing commands${R0}
${S3} *Shebang (#!)${R0}
${S3} *how to give exicution permission to any script${R0}
${S3} *how to run a bash script${R0}
${S6}2. Introduction to basic commands${R0}
${S3} *ls -List directory contents${R0}
${S3} *echo -printing command${R0}
${S3} *touch -file creating command${R0}
${S3} *mkdir -directory creating command${R0}
${S3} *grep -search command${R0}
${S6}3. Basic commands part -2${R0}
${S3} *man — Print manual or get help for a command${R0}
${S3} *cd — Change directory${R0}
${S3} *pwd — Print working directory${R0}
${S3} *mv — Move or rename directory${R0}
${S3} *rmdir — Remove directory${R0}
${S6}4. Introduction to some advanced commands${R0}
${S3} *locate — Locate a specific file or directory${R0}
${S3} *less — view the contents of a text file${R0}
${S3} *compgen — Shows all available commands, aliases, and functions${R0}
${S3} *> — redirect stdout${R0}
${S3} *cat — Read a file, create a file, and concatenate files${R0}
${B3}${S5} This program is under development so expect some quirks! Other chapters will be added very soon !!${R0}${R1}
"
else
chap=(1 2 3 4)
for i in ${chap[@]}; do
__chapter${i}__
done
fi