View difference between Paste ID: af4Tfkjx and 35cx5ZdK
SHOW: | | - or go back to the newest paste.
1
# Updated to fix a glitch that caused the directory listing location to output multiple 
2
# lines when viewing a directory with spaces in it.
3
4
# Custom directory listing function for great justice and my own amusement.
5
function ll () {
6
	# Suss out the directory we're trying to list
7
	if [ -d ${@:-1} ]
8
		then location=${@:-1}
9
		else location=`pwd`
10
	fi
11
	# Put together our directory listing, with custom headers.
12-
		printf '\x1b\x5b34m<index \x1b\x5b32mlocation\x1b\x5b35m=\x1b\x5b33m\"%s\"\x1b\x5b34m>\x1b\x5b00m\n' $location &&
12+
13
	# Pipe the output through more
14
	{
15
		printf '\x1b\x5b34m<index \x1b\x5b32mlocation\x1b\x5b35m=\x1b\x5b33m\"%s\"\x1b\x5b34m>\x1b\x5b00m\n' "$location" &&
16
		ls -FGhlpv --group-directories-first --color=always $@ &&
17
		printf '\x1b\x5b34m</index>\x1b\x5b00m\n';
18
	} |more
19
}