BAEL-3370: Cleaned up examples
This commit is contained in:
parent
7da51d09af
commit
a2b9b697cb
|
@ -1,5 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# section 2.1
|
||||
default_read() {
|
||||
read input1 input2 input3
|
||||
echo "[$input1] [$input2] [$input3]"
|
||||
}
|
||||
|
||||
# section 2.2
|
||||
custom_ifs_no_array(){
|
||||
IFS=";"
|
||||
read input1 input2 input3
|
||||
echo "[$input1] [$input2] [$input3]"
|
||||
}
|
||||
|
||||
# Section 2.3
|
||||
prompt_read_password(){
|
||||
prompt="You shall not pass:"
|
||||
|
@ -17,19 +30,6 @@ array_read() {
|
|||
done
|
||||
}
|
||||
|
||||
# section 2.2
|
||||
custom_ifs_no_array(){
|
||||
IFS=";"
|
||||
read input1 input2 input3
|
||||
echo "[$input1] [$input2] [$input3]"
|
||||
}
|
||||
|
||||
# section 2.1
|
||||
default_read() {
|
||||
read input1 input2 input3
|
||||
echo "[$input1] [$input2] [$input3]"
|
||||
}
|
||||
|
||||
# section 3.1
|
||||
file_read(){
|
||||
exec {file_descriptor}<"./file.csv"
|
||||
|
@ -43,7 +43,7 @@ file_read(){
|
|||
}
|
||||
|
||||
# section 3.2
|
||||
advanced_pipeing(){
|
||||
command_pipe(){
|
||||
ls -ll | { declare -a input
|
||||
read
|
||||
while read -a input;
|
||||
|
@ -68,65 +68,4 @@ exactly_n_read(){
|
|||
read -p "$prompt" -N 11 -t 5 input1 input2
|
||||
echo -e "\ninput word1 [$input1]"
|
||||
echo "input word2 [$input2]"
|
||||
}
|
||||
|
||||
|
||||
advanced_pipeing_ps(){
|
||||
# process substitution
|
||||
declare -a input
|
||||
while read -a input
|
||||
do
|
||||
echo "${input[0]} ${input[8]}"
|
||||
done < <(ls -ll)
|
||||
}
|
||||
|
||||
custom_ifs_read(){
|
||||
declare -a input_array
|
||||
while IFS=";" read -a input_array -r
|
||||
do
|
||||
for element in ${input_array[@]}
|
||||
do
|
||||
echo -n "$element.backup "
|
||||
done
|
||||
echo ""
|
||||
done < "file.csv"
|
||||
}
|
||||
|
||||
infinite_read(){
|
||||
while read -d "?" -ep "Input:" input
|
||||
do
|
||||
echo "$input"
|
||||
done
|
||||
}
|
||||
|
||||
custom_ifs(){
|
||||
declare -a input_array
|
||||
IFS=$1 # whitespace
|
||||
read -a input_array -p "Enter something with delimiter <$1>:"
|
||||
for input in ${input_array[@]}
|
||||
do
|
||||
echo "[$input]"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
#default_read
|
||||
#array_read
|
||||
#special_delim
|
||||
file_read
|
||||
#prompt_read
|
||||
#default_input_read
|
||||
#advanced_pipeing
|
||||
#custom_ifs_read
|
||||
#infinite_read
|
||||
# custom_ifs " "
|
||||
# custom_ifs ";"
|
||||
#custom_ifs_no_array
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
|
||||
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
|
||||
when an unknown printer took a galley of type and scrambled it to make a type specimen book.
|
||||
It has survived not only five centuries, but also the leap into electronic typesetting,
|
||||
remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset
|
||||
sheets containing Lorem Ipsum passages, and more recently with desktop publishing software
|
||||
like Aldus PageMaker including versions of Lorem Ipsum.
|
Loading…
Reference in New Issue