All Questions
Tagged with bash command-line
1,623
questions
0
votes
0
answers
30
views
How do I determine which line has too many arguments within the script itself?
When I run the script I get the following errors:
./A_High_Stakes_investigations.sh: line 11: [: too many arguments
./A_High_Stakes_investigations.sh: line 11: [: too many arguments
./...
1
vote
1
answer
25
views
How to run sendmail as another other user?
I am witnessing behaviour I cannot explain.
If I run sendmail as another user by executing the following commands seperately - that is, typing each command and pressing enter before entering the next:
...
0
votes
0
answers
21
views
Wrapper to monitor CPU and memory usage for a command line without knowing its duration in advance [duplicate]
This great (in my opinion) answer on Super User provides a solution to track CPU and memory usage of a command line. It is great, however, you need to know in advance the duration of your command line....
0
votes
0
answers
205k
views
What does Bash command //xxx[] do? [closed]
I accidentally forgot to (double) quote $pat (should be echo "$pat"):
$ pat="//xxx[]" ; time echo $pat
//xxx[]
real 0m4.704s
user 0m0.000s
sys 0m0.016s
$ bash --version
...
1
vote
1
answer
34
views
how do I format the wildcard inside the BOOLEAN expression so that it tests for all extensions?
I'm trying to sync two directories, Masters and Proxies, via a bash script:
# Loop through files in Proxy Files folder
for file in "$ProxyFilesDir"/*; do
# Extract filename without ...
0
votes
1
answer
56
views
Desktop shortcut with a command line argument which contains filename with random numbers
I'm trying to create a desktop shortcut which launches a terminal app with commandline arguments which contains a path to a file with a randomly generated number in the filename.
I've tried everything ...
0
votes
1
answer
38
views
exit code segment causes Bash prompt to freak out
My Bash prompt (based on mike kasberg's) generally works fine. But when I get an error code, and then write over to the next line, no newline is generated, so the text goes back over my previous ...
1
vote
0
answers
29
views
How to Identify and Terminate Idle tmux Sessions on a Debian Server
I have a Debian server with multiple tmux sessions running. Some of these sessions are idle and not running any active processes. How can I identify and terminate all tmux sessions that are not ...
-1
votes
1
answer
50
views
Hide files and folders with same name
I ran into an issue where I had to restart my computer during a large extraction process involving many zip files :(.
All the zip files contain a folder that has the name of the zip file (minus .zip)
...
0
votes
1
answer
66
views
How to use grep with a pipe symbol from the command line
Maybe I'm missing something very simple, but I don't seem to be able to use grep from the command line (in bash) where the search argument contains a vertical bar |.
For example,
grep a|b
results in ...
0
votes
1
answer
138
views
ls -ltr on the terminal lists the files but says "No such file or directory" in a shell script
I am new to Bash and am practicing some shell scripts. I wanted to write a script to list all the folders and their file count, if a root path is passed as a parameter value from the terminal. The ...
17
votes
2
answers
4k
views
How does ls know how to output its results?
While creating a bash script, I found that this code ls puts all files on one line:
pi@raspberrypi:~/ptlrestinterface$ ls
update.sh web.config MyApp.runtimeconfig.json
still ls | head -n1 ...
0
votes
1
answer
33
views
sed does not consume rest of the line
I have one line of different words stored in a txt file
N/A 9.0 Yes Yes N/A N/A N/A N/A 8.8 Yes Yes N/A N/A N/A N/A 8.7 Yes Yes N/A N/A N/A N/A 9.2 Yes Yes Yes Yes Yes Yes 9.1 Yes Yes Yes Yes Yes Yes ...
0
votes
1
answer
80
views
Why do string variables in a bash script behave differently when echo'ed than they do when passed to an executable?
I have the following script:
#!/bin/bash
KID3=$(command -v kid3-cli)
ARG1="-c 'get'"
file="'1-01 - Johann Strauss - __Waldmeister___ Ouverture.flac'"
echo Command:
echo "$...
1
vote
2
answers
177
views
FFMpeg: How to get the real return value in bash
I've always used ffmpeg via a cmd-script and I always could check the %ERRORLEVEL% which was always '0' on success or '!0' if an error occured.
I'm trying to recode my cmd-scripts in bash (using msys2 ...