Questions tagged [bash]
Bash is a free shell for Unix-like operating systems from the GNU Project.
11,768
questions
0
votes
1
answer
32
views
How to Preend or Append File Name to Reflect Number of Pages in PDF using "qpdf" and "perl"
I am running the script at the bottom as a one-liner but have expanded for ease of reading.
Assume the directory contains the following file: File (11).pdf.
When the script executes, it simply repeats ...
0
votes
0
answers
28
views
Letter "b" in terminal doesn't work only in terminal and other letters is fine
in parrot os
when i try to write "bash" for example it's written ^[[1;5Dash letter b in terminal displays as ^[[1;5D and This just happens in terminal in any other app it's work
in other ...
1
vote
1
answer
97
views
Using sed to edit filepath variable
I am trying to use the sed command to edit a value in the .git/config file. When running the remote origin command, the config file creates the line of text like this":
url = https://github.com/...
0
votes
0
answers
9
views
Start vlock as a screensaver on console only debian
I am using a revived Chromebook as a secondary laptop. The eMMC is mostly fried, but I have a UEFI grub settup that boots Debian from an SD card. It is console only - no X11, etc.
I can get the screen ...
2
votes
0
answers
35
views
Why is GNU wget only returning an index.html.tmp file, instead of the actual files I want?
I want to download a lot of satellite data (organized by each day of each year) in .hdf format from NASA's LAADS DAAC archive. They have a helpful guide that provides a code sample to use with GNU ...
0
votes
1
answer
44
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 ...
1
vote
0
answers
30
views
Set background colour in Windows Terminal, with git bash ANSI escape OSC 11 doesn't work
How do I get git bash to set terminal background colour using OSC Ansi Escape sequences?
printf %b '\e]11;rgb:30/00/00\a'
It works when I do it from WSL bash and for some servers when I ssh to them ...
1
vote
1
answer
42
views
SSH from A through B to C, using private key on B
Schematic:
ssh ssh
A ------> B ------> C
^ ^
using A's using B's
ssh key ssh key
Preconditions:
A is running ssh-agent
A can access B
B can access C
A can't ...
0
votes
1
answer
28
views
How to detect even or odd minutes in bash script
I need to detect whether the current minutes are even or odd regardless of the time zone !
I tried this according to answers from several sites:
#!/bin/bash
n=$(date +"%M")
r=`expr$n%2`
if [...
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
24
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
vote
1
answer
19
views
Does bash support variable substitution in return statement?
Does bash support variable substitution in return statement?
From man bash:
return [n]
Causes a function to stop executing and return the value specified by n to its caller.
Is n allowed to be ...
2
votes
1
answer
67
views
Provide argument while starting a service using systemctl
I have a service installed on an old server and it is started using;
service load-simulator start medium
The value medium acts as a profile of sorts. It can have values like low, medium, high, and ...
1
vote
1
answer
38
views
ssh -t host1 ssh host2 "cat < /tmp/test.txt" – file not found
I'm trying to run cat < /tmp/test.txt on remote host host2 through host1. The file /tmp/test.txt exists on host2. I try:
# locally
ssh -t host1 ssh host2 "cat < /tmp/test.txt"
The ...
3
votes
2
answers
433
views
bash see if element inside array is inside a different array
I am trying to test to see if an element inside an array exists. A test case is
array1=(a b c)
array2=(c d e)
for ((i=0; i < ${#array1[@]}; i++)); do
if [[ ${array1[$i]} == "...