Skip to content

Instantly share code, notes, and snippets.

@janfri
Created March 20, 2014 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janfri/9662526 to your computer and use it in GitHub Desktop.
Save janfri/9662526 to your computer and use it in GitHub Desktop.
A script to execute ls if $1 is a directory or less if $1 is a file.
#!/bin/sh
if [ -d $1 ]; then
ls -l $1
elif [ -f $1 ]; then
less -S $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment