|
neurotech posted:What does chmod u+x do? I normally just do chmod +x https://linux.die.net/man/1/chmod u - means user That is, make the script executable for the current user. "g" would mean group, and "a" means all. "o" - not in the group.
|
# ? Mar 12, 2024 01:56 |
|
|
# ? Apr 28, 2024 21:42 |
|
Cool, thank you.
|
# ? Mar 12, 2024 01:58 |
|
hifi posted:If it only runs the first one then it's returning something other than zero; '&&' is a logical AND, so if the first one is false then there's no way the entire statement can be anything other than false. How do I debug this? Is there an equivalent of try/catch for bash scripts?
|
# ? Mar 12, 2024 01:59 |
|
neurotech posted:
If you echo $PATH and there are directories that are in your user folder, then you can move them into that directory and execute them without the path, eg how you would run 'ls'. If there aren't any then you have to make ~/.bin or ~/tools or whatever sounds nice and then add it to your path and restart your session before you can do that.
|
# ? Mar 12, 2024 02:01 |
|
neurotech posted:Thanks for those replies, that is a huge help. get rid of $SHELL and the exec. idk what your superuser answer is up to, it must have been for someone's very specific problem. put the script anywhere you want in your home directory as long as its on your $PATH. you can check the value of $PATH by doing `echo $PATH` in your terminal. if you dont have anywhere then you can add one in your .bashrc, for example if i wanted to add a directory named ~/lmao I could add this line to .bashrc: export PATH="$PATH:$HOME/lmao"
|
# ? Mar 12, 2024 02:01 |
|
neurotech posted:How do I debug this? Is there an equivalent of try/catch for bash scripts? 'set -x' will print everything that gets run. I dont really know how it works with exec and bash -c, etc
|
# ? Mar 12, 2024 02:03 |
|
first thing for that is to just run that command normally and then run `echo $?` to see what the return code was
|
# ? Mar 12, 2024 02:04 |
|
neurotech posted:AFAICT yt-dlp is not returning any errors. That sounds like a weird idea, never seen that used before. If you have the link to that advice I'd be interested to see it. I suspect the $SHELL is also the reason why your command chaining doesn't work, 'music url2' will only be executed after 'music url1' finishes, but it never does since it's running your new shell. If you run your script a bunch of times and then run 'pstree' you will probably see several nested music- and bash-processes. Also, you may want to use 'music url1 ; music url2' instead. '&&' is used in a situation where you don't want the second command to execute if the first one wasn't succesful.
|
# ? Mar 12, 2024 02:06 |
|
neurotech posted:How do I debug this? Is there an equivalent of try/catch for bash scripts? Welcome to debugging in bash, haha. As other have said, 'set -x' is your friend. Check out this page that has a couple of more helpful flags: https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425 Other than that, don't go too crazy with scripts.A few lines is fine, for more complex stuff just pick your favourite scripting language and solve your problem there. Saukkis posted:Also, you may want to use 'music url1 ; music url2' instead. '&&' is used in a situation where you don't want the second command to execute if the first one wasn't succesful. The || operator exist too and does what it should (OR). Volguus fucked around with this message at 02:10 on Mar 12, 2024 |
# ? Mar 12, 2024 02:08 |
|
im like 99% sure the script will work just fine without the exec in the alias and the $SHELL at the end lol
|
# ? Mar 12, 2024 02:09 |
|
Volguus posted:Welcome to debugging in bash, haha. As other have said, 'set -x' is your friend. Check out this page that has a couple of more helpful flags: https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425 Another option is to run it with 'bash -x script', so there isn't need to edit the file.
|
# ? Mar 12, 2024 02:11 |
|
Yeah. It works nicely with the exec and $SHELL removed. Thanks everyone.Saukkis posted:That sounds like a weird idea, never seen that used before. If you have the link to that advice I'd be interested to see it.
|
# ? Mar 12, 2024 02:13 |
|
just to explain why that question is different from your situation - they want to run the script with a double-click and have it leave the terminal open. you are just trying to run the script from an already open terminal. in your case when the script finishes running you just get back to your current shell anyway.
|
# ? Mar 12, 2024 02:17 |
|
Yaoi Gagarin posted:just to explain why that question is different from your situation - they want to run the script with a double-click and have it leave the terminal open. you are just trying to run the script from an already open terminal. in your case when the script finishes running you just get back to your current shell anyway. Much appreciated, that makes sense.
|
# ? Mar 12, 2024 02:17 |
|
neurotech posted:Yeah. It works nicely with the exec and $SHELL removed. Thanks everyone. No, that guy's problem is like if you have a .bat file in windows and you double click it and it opens an instance of cmd.exe disappears instantly
|
# ? Mar 12, 2024 02:17 |
|
neurotech posted:
Just as a side note to all the stuff you've got, you can use $@ so the script will read an arbitrary number of file names instead of having to chain together code:
code:
|
# ? Mar 12, 2024 03:22 |
|
Inceltown posted:Just as a side note to all the stuff you've got, you can use $@ so the script will read an arbitrary number of file names instead of having to chain together Ahhh that's perfect, thanks.
|
# ? Mar 12, 2024 04:45 |
|
Inceltown posted:Just as a side note to all the stuff you've got, you can use $@ so the script will read an arbitrary number of file names instead of having to chain together More familiar with Windows command line than linux, I started to say "Up to the max length for commands, which you can fill up with long url strings faster than you'd think." And then I thought "but what's the Linux maximum?" Turns out it's variable, but you can run a command to see your local limit: getconf ARG_MAX Suffice to say, you can download a whole lot of youtubes.
|
# ? Mar 12, 2024 13:09 |
|
is there something that works like cat, but it can print some kind of header before each file telling you what the name of that file was? I can script this myself but I want to know if there's already a tool for it
|
# ? Mar 12, 2024 19:24 |
|
If it is something that can be done in five seconds as a one line script at the prompt itself then you can assume that nobody has bothered to write a tool for it.
|
# ? Mar 12, 2024 19:35 |
|
'more' will do that, assuming you don't mind hitting a key for the pages. It doesn't look like it has an option to skip pagination. But if you pipe it to cat you get what you want.
|
# ? Mar 12, 2024 19:48 |
|
tail -vn+0 $file
|
# ? Mar 12, 2024 20:00 |
|
Yaoi Gagarin posted:is there something that works like cat, but it can print some kind of header before each file telling you what the name of that file was? I can script this myself but I want to know if there's already a tool for it here's my "cat all the files in this directory": code:
|
# ? Mar 12, 2024 20:56 |
|
Among other things bat will do this and many other overly-fancy cat things.
|
# ? Mar 12, 2024 21:57 |
|
This may end up just being rubber ducking but I'll try anyways: We have a requirement to run a firewall on our linux systems (using nftables) and also a requirement to let users run podman containers AND expose ports to those containers. There's two issues with that: for one podman doesn't support nftables yet, and for two, podman seems to assume you're running a blank firewall so there's not really any documentation on how to actually fit it into an existing management setup. Fortunately the first problem is simple, podman makes its iptables rules and for the most part they "just work" alongside the nftables rules. Containers can reach the world, containers can talk to each other, and dns is working. The second one is being an rear end in a top hat though. Our FORWARD chain has a default drop policy as well as a reject at the end of the chain. So I need to craft a rule to accept traffic when it hits a certain port. If I got a container run with something 'podman run -dt -p 8080:80 quay.io/libpod/banner' I would expect I need to open up port 8080 to the world (eg, tcp dport 8080 counter accept). However it doesn't work, but if I instead use a rule like 'tcp dport 80 counter accept' external access works. This feels like a misunderstanding of packet mangling inside the kernel. Does this mean the forward chain is being processed after nat translation so the 8080 dport is "lost"? I don't have a great concept of packet flow in the kernel despite much time scrolling around on the flowchart image that's available and I find it very hard to debug single packets because as near as I can tell there's no tools for it. Is there some other field in these incoming packets I can filter on? Or some kind of modification in prerouting that I can make that helps? I guess worst case I can just filter on the internal port of the containers but that feels bad and dumb to me. Alternatively I can change the forward change to a default accept policy. That feels like bad practice but is it really? The forward chain only gets parsed when the system is trying to route a packet so maybe the methods of attack are pretty insignificant.
|
# ? Mar 12, 2024 22:56 |
|
After sleeping/thinking on it I came up with using marks to fix this. In prerouting I added a rule to set a mark on any packet that hits a port I want to be world accessible, eg 'counter tcp dport 8080 meta mark set 1'. Then in my forward chain I added a rule to accept any packet with that mark set that is also destined for the podman subnet, eg 'ip daddr 10.88.0.0/16 meta mark 1 counter accept' This does what I want but I am unsure if this is a sane practice or is an idiot decision that will break later in ways I am too dumb to predict.
|
# ? Mar 13, 2024 15:21 |
|
skooma512 posted:So I want to try dual booting again and using Linux as my desktop beyond just the container platforms I use now. In my experience using NTFS to run modern games on Linux works but is very slow. Not a problem with old games but a big problem with modern AAA titles. Also you must make sure the drive is mounted such that your user owns it, not root, because chown does not seem to work properly on NTFS. Woolie Wool fucked around with this message at 22:02 on Mar 13, 2024 |
# ? Mar 13, 2024 21:59 |
|
drat, installing TLP seems to have made a big difference to power consumption on my laptop. Inflection point here is where I installed it. Wasn't doing much but browsing and youtube, power consumption before seemed pretty abnormally high
|
# ? Mar 14, 2024 00:12 |
|
sericea is pretty wild. an immutable distro with all text file editing for configs. its giving me serious whiplash lol. what decade is it?
|
# ? Mar 14, 2024 14:31 |
|
RFC2324 posted:sericea is pretty wild. an immutable distro with all text file editing for configs. I've been using it for a couple weeks now. I think I really like tiling window managers. I have had some issues with things, but that is more related to the immutable distro and primarily using containerized apps part. The toolbox is cool. An even easier way to manage podman containers that need access to some of your user's files. I tend to create one for each coding project I am working on in order to prevent any kind of dependency issues. I also have one to run virt-manager for my Windows VM so that I can watch NBA League Pass (they blocked out Linux from accessing it a year or so ago) and also update the firmware of some of my devices that don't have Windows utils working. I still need to figure out how to get USB redirecting working for that part, though. Getting an error when trying to do it through virt-manager. I have had some sound issues, too, but I think that is mostly a thing with the niche audio devices I use more than anything else. Most of it has worked pretty well. Flatseal has been a wonderful tool.
|
# ? Mar 14, 2024 15:24 |
|
Idk if its my networking on Windows or what but I was getting loads of connection and prediction errors in Apex, so on a lark I reinstalled Arch and switched over it for a night and it was like butter. "Hold I gotta boot up my Linux drive to play games guys, sorry!" words spoken by the utterly deranged
|
# ? Mar 14, 2024 15:43 |
|
Kibner posted:I've been using it for a couple weeks now. I think I really like tiling window managers. I have had some issues with things, but that is more related to the immutable distro and primarily using containerized apps part. Im genuinely enjoying it, and think I am going to use it for my new work machine. Its a terrible idea for a gaming rig, but amazing for a work machine. Toolbox immediately made me start thinking how to use it to make sysadmin better
|
# ? Mar 14, 2024 16:24 |
|
RFC2324 posted:Im genuinely enjoying it, and think I am going to use it for my new work machine. Its a terrible idea for a gaming rig, but amazing for a work machine. Toolbox immediately made me start thinking how to use it to make sysadmin better I'm actually using it for gaming, too! Only Steam games, so far, and the only unexpected problem has been needing to switch away from my 24-input mixer to my stereo DAC in order before launching some games in order to get sound to work. I can switch audio devices back to my mixer after the game finishes launching and it gets sound just fine. Just can't launch with it as the default device. Still need to install Battle.Net and I am messing around with trying to get the old game Asheron's Call working, too. But, hey, that is what Lutris and company are for! I think the one thing that I have not found a fix or work around for is having my notifications go to my top monitor (I have a vertical stack). The bottom monitor is my main monitor both in how I use it and how the Sway sees it (because my primary monitor has the "first" virtual desktop). System notifications just seem to default to the top monitor for whatever reason.
|
# ? Mar 14, 2024 17:00 |
|
Kibner posted:the only unexpected problem has been needing to switch away from my 24-input mixer to my stereo DAC in order before launching some games in order to get sound to work. I can switch audio devices back to my mixer after the game finishes launching and it gets sound just fine. Just can't launch with it as the default device. This is why Linux is so dangerous for me. There’s a decent chance that I would hit this and then end up pulling source for the whole dependency chain of the audio system, and then I spend two weeks becoming an audio-sampling-and-buffering Guy to no practical avail except that I’m now on 3 additional mailing lists and am following two dozen noisy GitHub issues. On Windows I just try updating drivers, rebooting, maybe poking in device manager, and then give up and live with it.
|
# ? Mar 14, 2024 17:04 |
|
Subjunctive posted:This is why Linux is so dangerous for me. There’s a decent chance that I would hit this and then end up pulling source for the whole dependency chain of the audio system, and then I spend two weeks becoming an audio-sampling-and-buffering Guy to no practical avail except that I’m now on 3 additional mailing lists and am following two dozen noisy GitHub issues. Get out of my head. Back in the early aughts, I bought a Sharp Zaurus, and immediately replaced the entire operating system with an open source fork. I didn't like how it booted, and set about fixing it. That lasted about a year, during which time my Zaurus was essentially inoperable. Moving to a Palm Pilot was great, because it didn't allow me to break the locked-down OS in an attempt to improve it. Great memories of debugging early userspace initialization scripts on a moving bus using the craptastic keyboard and a 6-pixel tall console font. cruft fucked around with this message at 17:18 on Mar 14, 2024 |
# ? Mar 14, 2024 17:10 |
|
Well, I fixed the notification issue just now. I found the default config file at /usr/etc/xdg/dunst/dunstrc I copied it to ~/.config/dunst/dunstrc and changed the line "monitor = 0" to "monitor = 1" and then restarted my session. Tested it with the command `dunstify "title" "content"` and it works how I want! I also learned that you can change the "follow = none" line to "follow = keyboard" or "follow = mouse" and the notifications will pop-up accordingly. For Wayland, both keyboard and mouse options work the same.
|
# ? Mar 14, 2024 17:33 |
|
FYI, while Toolbox is totally fine, there's little reason not to install Distrobox. They're both wrappers around podman, but Distrobox has some important improvements like automatic export of desktop apps and restricting container mounts to something other than your full $home.
|
# ? Mar 14, 2024 23:18 |
|
Is there a way to force a fullscreen program to run on a specific monitor on KDE/Wayland from the console? There are some games I would like to play on my CRT which is set as my secondary monitor, and often they don't respond well to using Alt+F3 to try to relocate them.
|
# ? Mar 16, 2024 21:09 |
|
Woolie Wool posted:Is there a way to force a fullscreen program to run on a specific monitor on KDE/Wayland from the console? There are some games I would like to play on my CRT which is set as my secondary monitor, and often they don't respond well to using Alt+F3 to try to relocate them. I just use a keyboard shortcut to point to Arandr script to change the Primary Monitor before launching the game (for Xorg, ofc) but I'm sure there's a similar one for Wayland? Reddit says: Plasma's tool is kscreen-doctor, kscreen-doctor --help for an introduction. (oh this is a Xrandr replacement, not Arandr, but I'm sure it'd work similarly). Alternatively, idk since you're talking KDE: https://github.com/maxwellainatchi/gnome-randr-rust
|
# ? Mar 16, 2024 21:14 |
|
|
# ? Apr 28, 2024 21:42 |
|
Another option is to use gamescope, which both a) can set a display output via command line b) is probably helpful for games with janky response to window repositioning / resize / alt-tab (as it is containing the game inside a dedicated micro-compositor and doesn't let the game know about such things) So if I wanted to run a steam game on my second monitor, I could do it with: gamescope -W 1680 -H 1050 -f --display-index 1 -- %command% I'm kinda 50/50 on gamescope, some games it's very helpful and some game it causes some small problems that seem pretty unique to itself. So I generally don't reach for it unless there are already issues. (OTOH I don't have a VRR monitor, a CRT, or other unusual stuff.)
|
# ? Mar 17, 2024 01:38 |