Created
August 28, 2023 01:07
-
-
Save k5njm/96f3c3d87aaa843547276e4739e7c0d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get the number of rows available in the terminal | |
ROWS=$(tput lines) | |
# Generate your nmcli content | |
CONTENT=$(nmcli -f SSID,RATE,CHAN,SIGNAL,BARS dev wifi list | awk '!seen[$1]++') | |
# Check if the content exceeds the available rows | |
if [ $(echo "$CONTENT" | wc -l) -gt $ROWS ]; then | |
# If it exceeds, display using 'less' | |
echo "$CONTENT" | less | |
else | |
# Otherwise, just display it normally | |
echo "$CONTENT" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment