-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray.sh
72 lines (60 loc) · 2 KB
/
array.sh
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
#!/usr/bin/env bash
# plugins bash moderen
. lib/moduler.sh
# depencies
Bash.import: text_display/colorama text_display/IO.ECHO
Bash.import: util/IO.FUNC util/io.class
Bash.import: util/IO.SYSTEM.var util/IO.TYPE
Bash.import: util/tryCatch
# author : polygon
def: sub_array(){
var subsrow : "$1";%% variable subsrow nya
var tentukan : 0; # untuk menentukan batas berhenti
var finis : 0; # validasi ke dua
while ((tentukan<subsrow)); do
let tentukan++
let finis++
if [[ $tentukan == $finis ]]; then
# system validasi subsrow simple
read -p "masukan element $tentukan : " s
# memparse space menjadi koma ,
var set_element : $(echo "$s" | sed 's;[[:space:]];, ;g')
# menyimpan hasil parse ke file dump_(jumlah row).txt
echo "[[$set_element]], " > dump_$tentukan.txt
fi
declare subsrow_sys+=$(cat dump_$tentukan.txt);%% simpan ke variable untuk di panggil += tidak akan menimpa
if [[ $tentukan == $subsrow ]]; then
var file : 0
for x in $(seq 1 $subsrow); do
let file++
rm -rf dump_$file.txt &> /dev/null
%% menghapus file dump_(jumlah row).txt
done; echo
var regex_array : ${subsrow_sys%%, };%% menghapus koma dan spasi di bagian akhir
println_info " hasil\n"
Tulis.strN "[$regex_array]\n";# cetak hasil ke display
break; # berhenti
fi; %% penutup statement if
done; # penutup statement loop while
}
Namespace: array.sh
{
def: main(){
echo
Tulis.strN "• Author : Bayu riski A.M (Speedrun|silent)"
Tulis.strN "• Language : Bash (Bourne again shell)"
Tulis.strN "• github : Bayu12345677"
Tulis.strN "• contributor : DemonNipon\n"
Tulis.str "masukan subrow : "
read row; echo
[[ -z "$row" ]] && { echo;println_info " row tidak boleh kosong minimal 7"; echo;exit; }
sub_array "$row";
Tulis.str "ingin input row berikut nya y/n : "
read input
if [[ $input == y ]]; then
main
elif [[ $input == n ]]; then
Tulis.strN "[-] Keluar\n"; exit
fi
};main
};