Commit 4ea139b4 authored by Kyle Muldoon's avatar Kyle Muldoon

uploaded script files

parent 4de5f109
# !/bin/bash
# sample.txt:
# 1,Apple,Color is Red
# 2,Mango,Color is Orange
# 3,Banana,Color is Yellow
input="../input/sample.txt"
tableName="myfruits"
lineFormat="(code,name,color)"
while read -r line;
do
code=$(echo $line | awk -F, '{print $1}')
name=$(echo $line | awk -F, '{print $2}')
color=$(echo $line | awk -F, '{print $3}')
echo "insert into ${tableName} ${lineFormat} values (${code},\"${name}\",\"${color}\")"
done < "$input"
\ No newline at end of file
# !/bin/bash
# Ensure non-null input to program
if [ "$#" -ne 1 ]; then
echo "Error: Missing Argument"
exit 1
fi
# # Collect input from args
input=$1
awk -F : '$5 == input {print "Home Directory: "$7}' /etc/passwd
\ No newline at end of file
#!/bin/bash
# Convert any string given as an argument to upper case
for var in "$@"
do
echo "${var^^}"
done
#!/bin/bash
# Iterate from 1 to 50, printing the odds
for i in {1..50}
do
if (( $i % 2 == 1 )); then
echo "Number is : ${i}"
fi
done
\ No newline at end of file
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