Status.sh under .config/sway for status bar works, constantly brings up an error message

I made a simple status.sh to display date, uptimes, and linux version, loaded it to config, and it works. However, whenever sway reloads (ie. when it reboots), it would bring up an error message. saying the there are invalid commands. For example, it would say that uptime_formatted= $(uptime | cut -d ‘,’ -f1 | cut -d ’ ’ -f4,5) has an invalid command.

Check the script again from where you copied it https://unix.stackexchange.com/questions/473788/simple-swaybar-example

To understand better, here is what you shared

uptime_formatted= $(uptime | cut -d ‘,’ -f1 | cut -d ’ ’ -f4,5)

vs what it should be according to that stackexchange

uptime_formatted=$(uptime | cut -d ',' -f1  | cut -d ' ' -f4,5)

see the difference?

3 Likes

Bash is horrible about extra spaces around operators…