Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
#!/bin/bash
OLDIFS=$IFS
string=$1
IFS='.'
string_array=($string)
len=$(( ${#string_array[@]} - 1 ))
IFS=$OLDIFS
echo ${string_array[$len]}
exl@exl-Lenovo-G560e:~/SandBox > ./token.sh ..log.f
f
exl@exl-Lenovo-G560e:~/SandBox > ./token.sh .log.ccc
ccc
exl@exl-Lenovo-G560e:~/SandBox > ./token.sh log.qwerty
qwerty
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question