Bash script for common errors
#4
(02-10-2020, 08:54 AM)PinePhoneCoder Wrote: Nice! You made a nice menu I see. I did sort of the same thing: Bash scripts for the basic functions of the PinePhone on GitHub: https://github.com/dirkjanbuter/pinephone-commands (I try to keep it up to date).

Hey, thanks for the script collection. Here's a little suggestion: I made a hidden script in the folder like this:




Code:
#!/bin/bash
scriptdir=$HOME/cmd/

cd $scriptdir
ls -1 | nl
echo "Make your choice"
read choice
choicetorun=$(ls -1 | nl -s \: | sed -e 's/^[ \t]*//' | grep ^"$choice"\: | sed -e 's/[0-9]\://' | sed -e 's/^[0-9]//')
./$choicetorun


It makes a list of the folder, like so:


Code:
pine:~/pinephone-commands/.la.sh
     1    change-password.sh
     2    ear-on.sh
     3    image-to-internal-storage.sh
     4    install-ffmpeg.sh
     5    install-samba.sh
     6    install-tor-site.sh
     7    killer.sh
     8    mixer.sh
     9    radio-nl-bnr.sh
    10    radio-nl-qmusic.sh
    11    speaker-half.sh
    12    speaker-max.sh
    13    speaker-mute.sh
    14    speaker-on.sh
    15    tor-my-domain.sh
    16    wifi-reset.sh
Make your choice


And you can choose the script you want by number. And if you add a script in the folder, you won't have to modify a file for to have a menu selection.


Messages In This Thread
Bash script for common errors - by aleadom - 02-09-2020, 02:38 PM
RE: Bash script for common errors - by tcode - 02-12-2020, 06:23 AM
RE: Bash script for common errors - by undo - 02-13-2020, 08:11 AM
RE: Bash script for common errors - by Goddard - 02-13-2020, 02:25 PM
RE: Bash script for common errors - by dukla2000 - 02-14-2020, 04:58 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)