Return to Snippet

Revision: 36943
at December 1, 2010 03:09 by Hexx


Updated Code
#!/bin/sh
# Simple Sort Script By Ben
for f in $@
do
	# Store parameters in temp file
	echo $f >> sortme.tmp
done
# Sort temp file
for f in `cat sortme.tmp | sort -n`
do
	f2="$f2 $f"
done

# Delete temp file
rm sortme.tmp

# Show output
echo $f2

Revision: 36942
at December 1, 2010 03:05 by Hexx


Initial Code
#!/bin/sh
# Simple Sort Script By Ben
for f in $@
do
	# Store parameters in temp file
	echo $f >> sortme.tmp
done
# Sort temp file
cat sortme.tmp | sort

# Delete temp file
rm sortme.tmp

Initial URL
http://www.amugofjava.me.uk/

Initial Description
Simple bash script that sorts a series of numeric parameters using a temporary file and sort command.

Initial Title
Simple Bash Sort Script

Initial Tags
sort, Bash

Initial Language
Bash