secretGeek / ok-bash

.ok folder profiles for bash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make `sudo` work

doekman opened this issue · comments

Now if you want to sudo an ok-command, you get an error:

$ sudo ok 16
sudo: ok: command not found

The following suggestions could work.

$ ok --sudo 16
$ ok --please 16
$ OK 16

Probably insert the sudo command. This should also work when the ok-line contains multiple commands.

Wow. I'm not the linux expert - so i wonder why sudo doesn't work as normal here??

Or it does, but ok mishandles the commands it's passed in the 'sudo ok 16' example?? (maybe ok thinks the first parameter is 'ok' not 16' ?)

Ok, agreed. First see what the actual problem is.

See this.

The command sudo ok fails with sudo: ok: command not found. This is because sudo always forks the process, and the ok function is not exported, so it fails.

Why: I used ok in different environments: on Debian I didn't have sudo installed, so I elevated rights with su - and on macOS I used sudo. That's why I needed the --sudo option. Now I have sudo default installed on Debian, so I don't need the option, and specify sudo in the .ok files where needed.

So theoretically there could be a need to include the --sudo option, but I don't need it.