All Questions
1,573
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
./...
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 ...
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 ...
0
votes
0
answers
57
views
Connect to PEAP wifi network on mac with a shell script
I am making a shell script for my mac and part of it requires connecting to my school's wifi network.
I have tried both of the following commands and while the settings wifi tab says that the computer ...
1
vote
1
answer
447
views
Complete overview of Bash and Zsh startup files sourcing order
I was confused in what order my shells source which files. When researching this for myself, I came across several sources online and even read some parts of the manuals for both shells. But still, ...
0
votes
1
answer
318
views
How to disable MOTD from Debian 12?
I am looking to disable MOTD on my Debian 12 systems. I updated my sshd_config file to not display MOTD but it is still showing up. Is it possible it is coming from another module and how can I ...
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
144
views
Linux Bash Wait Command Not Working
I am trying to use and bash file .sh to start other bash files in seperate terminals.
I want them to run one after the other as I use them to copy large numbers of files to the same Hard Drive. ...
2
votes
2
answers
76
views
Avoiding accidental execution of python scripts as bash scripts
I like to run my python scripts directly in bash like so
$ ./script.py
But sometimes I forget the shebang line #!/usr/bin/env python3, and it has the potential to overwrite a file named np if the ...
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 "$...
0
votes
0
answers
118
views
Can you write a script that contains both bash (or sh) and powershell (or cmd, bat) so the same file can be executed on Win and *nix?
I have a script that needs to run on Windows, Linux and MacOS.
I know Windows determines how to run a script by using the file extension, where *nix will use the #!.
I'm hoping there is enough syntax ...
0
votes
0
answers
92
views
How to launch another blank terminal in Kali Linux?
When I launch another terminal in Kali Linux with Cmd+Shift+T, I can see Shell No. 2 tab created.
However, it is just a copy of Shell No. 1 and all the commands I ran on Shell No. 1 are visible on ...
2
votes
1
answer
136
views
Execute self-extracting bash script (with binary data appended) w/o saving it first
I have a self-extracting bash script (binary data appended to the end) like this:
#!/bin/bash
export TMPDIR=$(mktemp -d)
ARCHIVE_START_LINE=$(...) # <omitted>
# extracting data archive into a ...
10
votes
4
answers
2k
views
Why does assigning a variable with command substitution, and then echoing that variable, always fail?
Why does the following not work in Bash?
# Ensure TEST is unset
export TEST=''
echo "Hello world!" > test.txt && TEST="$(cat test.txt)" echo "$TEST"
It always ...
0
votes
0
answers
246
views
how to use curl for single sign-on website or page
I've already written a shell script but it's not working. I'm getting an empty response whereas it should first return a token and also it should login then register the API.
That's the task which my ...