4

I'm trying to learn Linux by creating a script to customize my user... install apps, update them, change the background, favorite apps, and some settings. I ran into a problem and I can't find a solution.

If I run the command

gsettings set org.gnome.shell favorite-apps "['chromium_chromium.desktop', 'whatsdesk_whatsdesk.desktop', 'messengerport_messengerport.desktop', 'enpass.desktop', 'steam.desktop', 'discord_discord.desktop', 'vlc_vlc.desktop', 'org.gnome.Terminal.desktop']"

from the terminal, everything works as expected, but if I put the same command into a script. it doesn't do anything

Can anyone please help me?

EDIT:

For anyone asking..my script is a mess of Linux commands... but i will paste it here

#!/bin/sh

add-apt-repository "deb https://apt.enpass.io/ stable main"
wget -O - https://apt.enpass.io/keys/enpass-linux.key | apt-key add -

sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y

sudo apt install steam-installer enpass openssh-server -y
sudo snap install whatsdesk discord messengerport libreoffice chromium vlc meteo

gsettings set org.gnome.shell favorite-apps "['chromium_chromium.desktop', 'whatsdesk_whatsdesk.desktop', 'messengerport_messengerport.desktop', 'enpass.desktop', 'steam.desktop', 'discord_discord.desktop', 'vlc_vlc.desktop', 'org.gnome.Terminal.desktop']"

sudo apt-get dist-upgrade -y
sudo snap refresh 
sudo apt autoremove -y
sudo apt-get autoclean -y

2
  • How is it failing? What do you mean by "put the same command into a script"? Are you trying to change GUI settings before the GUI starts?
    – waltinator
    Commented Aug 28, 2020 at 0:24
  • If I run the command as is it is in the terminal, chromium ant the other apps will be placed on the "favorites bar" (i don't really know how its called) but, If try to create a script with just that command, nothing will happen No errors, no messages, and no GUI changes, nothing And no, I'm not trying to change the GUI before it starts Commented Aug 28, 2020 at 1:48

1 Answer 1

3

I solved my problem...My mistake was the fact that I was running the script using "sudo"

So instated of typing

sudo bash script.sh

in the terminal, I only run

bash script.sh

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .