Advertisement
metalx1000

Selectable Menu for Functions

Nov 12th, 2022
1,781
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.26 KB | Source Code | 1 0
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2022  Kris Occhipinti
  4. #https://filmsbykris.com
  5.  
  6. #This program is free software: you can redistribute it and/or modify
  7. #it under the terms of the GNU General Public License as published by
  8. #the Free Software Foundation, either version 3 of the License, or
  9. #(at your option) any later version.
  10.  
  11. #This program is distributed in the hope that it will be useful,
  12. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. #GNU General Public License for more details.
  15.  
  16. #You should have received a copy of the GNU General Public License
  17. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18. ######################################################################
  19.  
  20. function ip(){
  21.   ifconfig wlp3s0|grep inet|grep -v inet6|awk '{print $2}'
  22. }
  23.  
  24. function ssid(){
  25.   iwgetid -r
  26. }
  27.  
  28. function date_format(){
  29.   date +%Y-%m-%d
  30. }
  31.  
  32. function running_time(){
  33.   uptime|cut -d\, -f1
  34. }
  35.  
  36. function hello(){
  37.   echo "Hello World"
  38. }
  39.  
  40. function bye(){
  41.   echo "Good-Bye"
  42. }
  43.  
  44. [[ "$1" ]] && $1 || eval $(grep '^function' $0|awk '{print $2}'|cut -d\( -f1|fzf --prompt "Selection a Function: " )
  45.  
Tags: BASH functions
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement