You are not logged in.

#3126 2017-12-28 00:16:47

Eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 1,420

Re: Post your handy self made command line utilities

Trilby wrote:

Eschwartz, I'd ask similar questions about netctl in general over wpa_supplicant and wpa_passprhase.

The reason would be menu-driven configuration over editing wpa_supplicant.conf -- regarding which, I don't actually know of a way to completely automate reconnecting to an SSID, but then again I've never actually tried to find out.

...Oh, I wasn't even aware that wpa_passphrase existed to generate wpa_supplicant.conf entries. Interesting. TIL.

So I guess you could write your own script(s) to use that for network management purposes, but eventually you end up reimplementing netctl anyway. big_smile

...

Anyway, the main point here is that if you are going to use netctl *anyway*, you might as well use it instead of calling it via a script that reimplements what netctl (the thing you elected to use) already does.

Offline

#3127 2017-12-28 00:40:43

Trilby
Forum Fellow
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 17,918
Website

Re: Post your handy self made command line utilities

Eschwartz wrote:

So I guess you could write your own script(s) to use that for network management purposes, but eventually you end up reimplementing netctl anyway.

Or just use dhcpcd.service with the wpa_supplicant hook and all of the above is included.  Or just wpa_supplicant.service if you don't use dhcpcd.

If you need menu driven, wpa_cli (included with wpa_supplicant) is pretty close.


Resist the GNU world order.

Online

#3128 2017-12-28 15:09:38

easysid
Member
From: India
Registered: 2013-01-01
Posts: 256

Re: Post your handy self made command line utilities

Eschwartz wrote:
Trilby wrote:

Eschwartz, I'd ask similar questions about netctl in general over wpa_supplicant and wpa_passprhase.

The reason would be menu-driven configuration over editing wpa_supplicant.conf -- regarding which, I don't actually know of a way to completely automate reconnecting to an SSID, but then again I've never actually tried to find out.

I use systemd-networkd with wpa_supplicant, and it does automatically reconnect to an SSID in case the connection drops. I don't know whether it supports profiles like netctl though.

Offline

#3129 2017-12-28 15:11:37

Trilby
Forum Fellow
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 17,918
Website

Re: Post your handy self made command line utilities

"Profiles" are just a really complicated and indirect way of managing a wpa_supplicant.conf.  They are almost verbatim wpa_supplicant.conf excerpts just with very odd quoting rules that make them error prone.


Resist the GNU world order.

Online

#3130 2017-12-28 16:22:17

whatshisname
Member
Registered: 2010-04-24
Posts: 158

Re: Post your handy self made command line utilities

Eschwartz wrote:

What is the advantage of this over netctl's wifi-menu for interactively selecting the ESSID to connect to, and saving netctl profiles for use with the netctl-auto service?

Or the NetworkManager daemon with either nmtui (console) or network-manager-applet (gui) as a frontend?

None at all.

Except that I didn't realize wifi-menu came with netctl! :-)

Oh, well.  It was fun writing the script anyway.

Offline

#3131 2017-12-29 12:03:23

quequotion
Member
From: Oita, Japan
Registered: 2013-07-29
Posts: 592
Website

Re: Post your handy self made command line utilities

This reminds me of my pressing need for a multiple-backend networking indicator. Really need to get working on that.

Offline

#3132 2018-01-14 05:33:49

YesItsMe
Member
Registered: 2017-07-12
Posts: 30

Re: Post your handy self made command line utilities

I wrote a tool to let me rename files per regex without having to be annoyed over the sed syntax.
https://bitbucket.org/tux_/remv

Offline

#3133 2018-01-14 06:21:38

Eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 1,420

Re: Post your handy self made command line utilities

Why, oh why, did you ever think that piping `ls|sed|sh` was a good idea?

Moreover, when the standard bulk file renaming utility is https://www.archlinux.org/packages/comm … rl-rename/

Offline

#3134 2018-01-14 14:16:02

YesItsMe
Member
Registered: 2017-07-12
Posts: 30

Re: Post your handy self made command line utilities

Not everyone knows all the options.
Oops! Thanks...

Offline

#3135 2018-01-14 21:22:39

Eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 1,420

Re: Post your handy self made command line utilities

Well, maybe not everyone knows all the options. But I'm more concerned at your initial fallback on https://mywiki.wooledge.org/ParsingLs, and as for piping to sh, that seems to be an innovative variety of the well-known disaster called "using eval" (eval has a small number of uses, and a vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, vast, number of horrible and ill-advised uses. No, that over-repetition of "vast" is neither a mistake nor an overexaggeration.)

None of this should have ever been your first fallback. Good bash programmers will try basically anything up to and including renaming everything by hand, out of fear of what this could accidentally do. wink

If you really wanted to use sed for this, you can. Just, please use find -print0 with sed's -z option, and pipe it to xargs! find is filename-safe for scripts, as it explicitly processes filenames as opposed to a formatted table that merely includes filenames, and using null-delimited input/output with both is something that should always be the first thing you try to convince your tools to use.

Last edited by Eschwartz (2018-01-14 21:29:25)

Offline

#3136 2018-01-14 21:27:23

YesItsMe
Member
Registered: 2017-07-12
Posts: 30

Re: Post your handy self made command line utilities

The disadvantage of the sed approach is that it's not really portable, not even in the Unix/Linux world (GNU sed vs. BSD sed - modify the options and you're doomed). This was my main motivation to write my own answer to this problem: No Windows support here. - That Perl thing would probably work though. Goodbye, motivation! neutral

Offline

#3137 2018-01-15 02:31:11

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,847
Website

Re: Post your handy self made command line utilities

I'm impressed you did all that in C++!

YesItsMe wrote:

Goodbye, motivation! neutral

That's why I always choose video games as my programming projects. There's always new ideas, and Linux doesn't have nearly enough of them. wink

Offline

#3138 2018-01-15 02:32:59

YesItsMe
Member
Registered: 2017-07-12
Posts: 30

Re: Post your handy self made command line utilities

C or Lisp (which I considered first) would probably have made my tool more nerdish, but C++ has everything I need in its standard library now, so it was a logical choice to me. smile

Last edited by YesItsMe (2018-01-15 02:33:33)

Offline

#3139 2018-01-15 09:31:50

easysid
Member
From: India
Registered: 2013-01-01
Posts: 256

Re: Post your handy self made command line utilities

YesItsMe wrote:

C or Lisp (which I considered first) would probably have made my tool more nerdish, but C++ has everything I need in its standard library now, so it was a logical choice to me. smile

If you want everything in the standard library, the logical choice is python, especially when dealing with strings smile

As an aside, Thunar has a sweet GUI for bulk renaming. The option to preview changes is quite handy when using regex

Offline

#3140 2018-01-15 09:35:15

YesItsMe
Member
Registered: 2017-07-12
Posts: 30

Re: Post your handy self made command line utilities

The disadvantages of Python (to me) are the lack of brackets and the awful performance. I prefer not to deal with it.
Thunar would again not be quite as portable as I intended it to.

Offline

Board footer

Powered by FluxBB