tolikpunkoff

get number of latin letter in alphabet simple

Jun 6th, 2019
139
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. #get number of latin letter in alphabet
  4. #use nlett <letter>, e.g nlett a
  5.  
  6. SNUM=0
  7. SFND=`echo $1|grep '^[a-z]$'`
  8. if [ -z "$SFND" ]; then
  9.     echo "Error: in first parameter must be one small latin letter!"
  10.     exit 1
  11. fi
  12.  
  13. ALPHABET="abcdefghijklmnopqrstuvwxyz"
  14. SNUM=`expr index $ALPHABET $SFND`
  15.  
  16. echo "$SFND is $SNUM"
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×