Skip to main content

All Questions

1 vote
1 answer
154 views

Shell script to run command and show output in notification box

I have command line utility that generates text strings, by running a command within the directory: ./Utility -P it prints output on terminal. How to make a shell script showing the generated string ...
minto's user avatar
  • 553
12 votes
2 answers
5k views

Check if current user can run sudo without requiring a password

I want to check if the current user running a BASH shell script has access to passwordless sudo or not. If they don't, I'd rather have the script exit rather than prompting them for a password.
Jay Taylor's user avatar
-1 votes
1 answer
260 views

What are some common uses for `run-parts`? [closed]

run-parts executes all programs and scripts in a directory -- but when do I need it? What are some common uses for it?
PetaspeedBeaver's user avatar
4 votes
2 answers
905 views

Combine two files as part of a command line parameter

I am trying to use csvgrep (part of csvkit) to extract rows matching one of two files. Unfortunately, there is no command line option that allows two matching files (like grep does). Only, csvgrep -f ...
Robert Altman's user avatar
3 votes
3 answers
908 views

Alternatives to file polling?

In the following code, I have to poll $tmp_input to continue executing the code because wezterm cli send-text is asynchronous. This makes sure that $tmp_input is ready. tmp_input=$(mktemp ./tmp_input....
wyc's user avatar
  • 143
0 votes
0 answers
206 views

Write output of multiple python scripts to single file

I used to have only one Python script, the output of which would be directed to a log file. It works like this: I have it in autostart, using crontab @reboot /bin/sleep 30; sudo /usr/bin/python3 -u /...
Dahlin's user avatar
  • 1
1 vote
2 answers
5k views

How to run the command "sudo sh /path/to/script.sh" by double clicking?

I have a question from this thread How to run a bash script by double clicking by entering the path in sudoers?. Since it was explained to me that it is unsafe to grant sudo privileges to the script....
moninah's user avatar
  • 15
0 votes
1 answer
217 views

Atrun command in macos is not starting

I'm learning the 'at' command in macOS. However, my 'at' command jobs are getting scheduled but never executing. For example, when I run a simple command like echo "hello world" | at 9:30 AM,...
Mathew Nelson's user avatar
1 vote
2 answers
439 views

Pinning a file to that it appears in the beginning in a folder

I am using Ubuntu (Linux mint). There is a mouse option, if I right-click on a file, I can then choose to pin a file (inside its folder), so that whatever file arranging method (alphabetical, by-date, ...
mahbubweb's user avatar
  • 141
0 votes
2 answers
363 views

missing argument to `-exec' error when executing Shell script but runs fine on command lines

I have this Shell script here: ### # Create a folder dynamically mkdir archived_PA_"$(date -d "6 months ago - 1 day" +%Y-%m-%d)"_"$(date -d "1 day ago" +%Y-%m-%d)&...
Anna Nguyen's user avatar
0 votes
1 answer
163 views

Big numbers not recognised as integers by bash?

So I am trying to write a script that prints the sum of every digit in a number, to the power of another number. So for example, if the input is: script 123 2 than the script calculates 1^2 + 2^2 + 3^...
Tomyy's user avatar
  • 155
0 votes
1 answer
385 views

How can i use a proxy server for whois command?

Well, my goal is to use a free proxy server to make the whois command requests in the terminal to control the limit of requests by ip and then immediately disable the proxy (I want it to work only for ...
Gabriel Castro's user avatar
2 votes
1 answer
455 views

notify-send with stderr in notification body if there is stderr

Suppose I have a command like: foo() { echo a echo b >&2 echo c echo d >&2 } I use the following command to process stdout in terminal but send error via notify-send foo ...
Ahmad Ismail's user avatar
  • 2,978
0 votes
3 answers
104 views

Process the same stdin two time and append the outputs

I have a json file that looks like: [ { "key": "alt+down", "command": "-editor.action.moveLinesDownAction", "when": "...
Ahmad Ismail's user avatar
  • 2,978
0 votes
2 answers
87 views

What's a clean way to run a specific command C for each line L of a given file F and then move every L where C(L) ran unsuccesfully?

Say that https://example.nosuchtld https://example.net https://example.org https://example.willfail is the content of urls.txt. I want to run <command> <url> for every URL/line of urls....
seconddayout's user avatar

15 30 50 per page
1
2 3 4 5
11