• shouldn't ">>" append ?


    [[email protected] ~]$ cat .config/openbox/autostart
    nitrogen --restore &
    volumeicon &
    compton --config ~/.config/compton.conf -b &
    tint2 &
    plank &
    conky -c ~/.config/conky.conf &
    guake &
    #/usr/lib/lxpolkit/lxpolkit &
    [[email protected] ~]$ sudo echo opensnap-quicktile >> .config/openbox/autostart
    [[email protected] ~]$ cat .config/openbox/autostart
    opensnap-quicktile

    [[email protected] ~]$ sudo echo asdfasd fa > .config/openbox/autostart
    [[email protected] ~]$ cat .config/openbox/autostart
    asdfasd fa
    [[email protected] ~]$ sudo echo asdfasd fdda >> .config/openbox/autostart
    [[email protected] ~]$ sudo echo asdfasd fdda >> .config/openbox/autostart
    [[email protected] ~]$ sudo echo asdfasd fdda >> .config/openbox/autostart
    [[email protected] ~]$ cat .config/openbox/autostart
    asdfasd fdda
    asdfasd fdda
    asdfasd fdda

    I have a backup. It’s really weird that appened wiped my file and then functioned properly. 😐

  • You should not use sudo within your /home directory. It did not wipe the file, it simply changed its owner to root which means you couldnt access it. You can change it back using this command:

    sudo chown  d:users ~/.config/openbox/autostart
    

    Cheers!

  • Thank you for your reply. While I’m not exactly sure about how sudo works to this day… and any advice is appreciated, the way i understand things, if you look at the code above, it did “wipe” the file contents because it replaced it completely and I was left only with what I wanted to append and nothing else. I also don’t get why you say I couldn’t access it, I could: cat returned contents and not some access error.

    I used sudo because I think I got the impression it was already already denying access otherwise. I don’t know why but I could imagine needing sudo to gain access to modify a file, while at the same time a regular owner could use it and read it and own it.

    I guess I might have created a file owned by root, the system totally disregarding that there’s another one owned by someone else already. That’s why append worked the second time.

  • @distrohopp As a rule of thumb, you never need to use sudo when working with files that are in your home dir. 😉

wtf1 bash error1 Posts 4Views 1147
Log in to reply
Bloom Email Optin Plugin

Looks like your connection to Antergos Community Forum was lost, please wait while we try to reconnect.