Skip to content

Instantly share code, notes, and snippets.

@danijeljw
Created October 6, 2013 05:37
Show Gist options
  • Save danijeljw/6849975 to your computer and use it in GitHub Desktop.
Save danijeljw/6849975 to your computer and use it in GitHub Desktop.
#!/bin/bash
function readName {
echo "Enter your full name:"
read fullName
clear
}
function cmprsName {
comp=${ echo "$fullName" } | sed 's/ //g';
}
function sayItNow {
echo $comp
}
function allTogether {
readName
cmprsName
sayItNow
}
case $1 in
-h | --help ) allTogether
exit
;;
* ) echo "$0 -h"
exit 1
esac
@danijeljw
Copy link
Author

  1. Takes full name
  2. Assigns to $fullName
  3. $fullName passed to sed to remove spaces
  4. Result assigned to $comp
  5. Result echo to stdout

Changing 's/ //g' to 's/ /-/g' will add dashes instead of removing spaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment