Skip to content

Instantly share code, notes, and snippets.

@ahmedengu
Created May 18, 2016 08:51
Show Gist options
  • Save ahmedengu/a0e59c2c00479f6b68fa3f547e45d703 to your computer and use it in GitHub Desktop.
Save ahmedengu/a0e59c2c00479f6b68fa3f547e45d703 to your computer and use it in GitHub Desktop.
bash sorting script
#!/bin/sh
read -p "enter n " n
declare -a ARR
for (( c=0; c<$n; c++ ))
do
read -p "enter " ARR[$c]
done
ARR2=( $(
for tmp in "${ARR[@]}"
do
echo "$tmp"
done | sort) )
echo ${ARR2[*]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment