-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Executing script with sudo: lolcat: not found #119
Comments
Same problem, any help on this? |
On what linux distro is this? (can not reproduce on Ubuntu) Maybe you can get around it by calling lolcat with its absolute path (as given by |
I'm on Centos 7 and I installed through Ruby, I removed and installed using snap and now i can call from a bash script. Gh05t1nTh3SSH, check if lolcat was installed in your home folder, if so remove and install with snap that worked for me. |
@JohnRamon Sudo doesn't pass along the path variable. You're installing a program into your user folder and expecting it to work for other users. If you want it installed globally without snap, install as root instead of your user. In general, you can't expect any software installed without Try |
@Gh0st1nTh3SSH in your second example, you're only passing the echo command to sudo, then passing the result of that to lolcat. That's why the command works with sudo echo and not within a script. If you wanted to pipe the output of the previous command, you have two options:
Add the full path to lolcat to your script (not recommended, use This is not a bug. |
@Efreak As You Marination And here is code Im Make...
|
sudo snap install lolcat |
I tried to create a stylish banner in a bash script by doing the following: create_3d_banner() {
# Reset color code
reset_color="\033[0m"
# Default Banner color code
blue="\033[34m"
# Banner text
banner_text=" AhMyth"
# Check if figlet and lolcat are installed
if command -v figlet > /dev/null 2>&1; then
# Use figlet to create ASCII art with mono9 font
figlet_output=$(figlet -f mono9 "$banner_text")
# Use lolcat to add color to the ASCII art
banner_output=$(echo "$figlet_output" | lolcat)
# Print the result
echo "${blue}${banner_output}${reset_color}"
else
if [ "$PACKAGE_MANAGER" = "apt-get" ]; then
apt-get install -y figlet
elif [ "$PACKAGE_MANAGER" = "pacman" ]; then
pacman -Sy figlet
# Reset color code
reset_color="\033[0m"
# Default Banner color code
cyan="\033[36m"
# Banner text
banner_text=" AhMyth"
# Use figlet to create ASCII art with mono9 font
figlet_output=$(figlet -f mono9 "$banner_text")
# Use lolcat to add color to the ASCII art
banner_output=$(echo "$figlet_output" | lolcat)
# Print the result
echo "${blue}${banner_output}${reset_color}"
fi
fi
}
create_3d_banner However everytime I tried to pipe the figlet results through lolcat, my terminal always told me For me, my Linux distro is Kali Linux which uses Anyways the solution to that problem for some reason is to either move or copy the lolcat executable file from the
After doing that, the So the solution, if you installed lolcat on Linux via apt, then move or copy the executable lolcat file from the # copy the file ovet
sudo cp /usr/games/lolcat /usr/bin
# move the file over
sudo mv /usr/games/lolcat /usr/bin |
Hi!
I'm trying to execute a script with sudo that contains an echo with lolcat.
Example file:
Without executing with sudo, lolcat is recognized and works as expected.
Also, when executing from terminal works well:
However, seems that sudo cannot execute lolcat within a script. Is this an expected behaviour? How can I make that sudo is able to recognize the lolcat command?
Thanks in advance,
The text was updated successfully, but these errors were encountered: