Skip to main content

Questions tagged [bash]

Bash is a free shell for Unix-like operating systems from the GNU Project.

Filter by
Sorted by
Tagged with
1 vote
2 answers
68 views

How can I sort my file by date if there are different number of spaces between the name and date?

How can I sort my file by date if there are different number of spaces between the name and date? My example file: Ivanov 03/01/1980 Petrov 10/05/1992 Sidorov 21/07/1985 Kovtun 15/...
Mykola's user avatar
  • 21
0 votes
3 answers
110 views

Replace X linebreaks with comma and delete every Nth linebreak

I have records in a text file formatted in the following way: Record1 Record1 Record1 Record1 Record2 Record2 Record2 Record2 ... I need to convert this file to CSV by replacing the first 3 line ...
Hashim Aziz's user avatar
0 votes
1 answer
71 views

How to bring a job to foreground and then disable job control in bash?

I have a program running in a terminal window. I wish to disable the Ctrl+Z shortcut from suspending the process. After pressing Ctrl+Z, the command fg && set +m unfortunately disables job ...
SeparatedScheme's user avatar
1 vote
1 answer
271 views

Bash: execute in parallel some processes but wait the slowest

Hello I'm writing a bash script where I have to restore around 8+ big sets of ip with ipset-restore command. Actually my shell script basically has a list like ipset-restore < list1.txt ipset-...
user3450548's user avatar
0 votes
1 answer
46 views

no-ignore-case in grep command

In man page of grep --no-ignore-case matching control has the following description: Do not ignore case distinctions in patterns and input data. This is the default. This option is useful for ...
tahzibi.jafar's user avatar
0 votes
1 answer
94 views

Bash function to make function for menu

I am trying to make a nicer menu in the terminal to improve my bash skills. I have been able to do so if i hard code all of the values. However, if the number of options varies then I am not sure what ...
Abbatrombone's user avatar
-2 votes
2 answers
298 views

execute command after switch to different user with sudo

I am trying to execute this command: echo hello | sudo su - dp-postgres But I get this: -bash: line 1: hello: command not found I also tried this: sudo su - dp-postgres -c 'echo hello' But that is ...
moth's user avatar
  • 121
0 votes
1 answer
125 views

How to view a folder with the name of "."?

A folder that is named ".", just dot and nothing else, does not appear in dolphin or krusader file managers. ls -a shows the folder. Terminal output: drwxrwxrwx - root 29 Feb 17:05 . ...
Rashiq's user avatar
  • 171
0 votes
2 answers
74 views

How to select a file named by strange character in a folder which has 2 same prefix file existed in linux?

such as: admin@DESKTOP-M6V5E4A MINGW64 ~/Workspace $ vi file_ file_2.json file_▒▒▒ָ▒▒▒▒ģ▒顣.json I can't use my mouse,how can I select the file_▒▒▒ָ▒▒▒▒ģ▒顣.json? I'v tried press my tab.but ...
Lilith Villa's user avatar
0 votes
1 answer
52 views

Bash script error issue with Debian preseed dpkg-configure string

I am working on some bash scripts to configure various packages the way I need them. When installing Debian 'unattended-upgrades' normally one of the user intervention required is to run *user@...
trebonedoow's user avatar
0 votes
0 answers
54 views

Unsing ranger fm, how can I preview a file's thumbnail

I have images in HEIC format on my Synology NAS. I installed ranger in a docker container, and I can preview most videos and images (connecting using iTerm on mac), but HEIC is not supported. Synology ...
Adi's user avatar
  • 131
1 vote
0 answers
46 views

Why can the tree view of MC have a folder as root in the version for PowerShell but not the version for Bash?

MC (Midnight Commander) has versions for both Linux Bash and Windows PowerShell. It has tree view but the feature seems different. In order to open a tree view with a folder as root of the tree on the ...
Dan D.'s user avatar
  • 731
-4 votes
1 answer
630 views

Issue Decrypting File with OpenSSL: "hex string is too short, padding with zero bytes to length"

I'm encountering an issue while trying to decrypt a file using Open SSL. I have a file named fc382Crypto.bin provided by my instructor, and I need to decrypt it using the blowfish algorithm with CBC ...
BariBx's user avatar
  • 1
0 votes
1 answer
55 views

grub-mkconfig doesn't populate /etc/grub.d/10_linux menu entries (Void Linux)

I have been writing a script to install Void Linux (I need something more granular that void-installer). I am able to install grub without issue on UEFI but the BIOS install doesn't work. I do grub-...
SammySP's user avatar
  • 101
0 votes
1 answer
34 views

shell helper function wrapping `find` and ignoring some dirs

I have a bunch of scripts which follow the pattern of: find files which match a pattern do something The problem is that there are several "hazard" directories which are large and slow, ...
Tim Hockin's user avatar
1 vote
1 answer
105 views

git is unable to properly determine the terminal width (git-bash, windows)

As you can see in the screenshot, the terminal is currently 100 characters wide, and both methods of detecting such that I'm aware of are returning the correct value. Despite this, unless I explicitly ...
davidmwhynot's user avatar
0 votes
1 answer
41 views

How to insert argument separating space into brace expansion preamble?

I want to use brace expansion to generate the following argument sequence: ./some_command -c root.foo -c root.bar -c root.baz. Brace expansion at first glance looks as a perfect tool: use -c root. as ...
Ivan Smirnov's user avatar
1 vote
2 answers
168 views

Why does zip --exclude only exclude files in the folder but not the folder itself?

I have the following command run in the bash shell which excludes the files in the folder scripts/. I tried the answer in Zip command for excluding directories and files but unfortunately it did not ...
Macky's user avatar
  • 93
1 vote
1 answer
325 views

Default shell zsh but responding bin/bash

I have no idea what I did! I was installing maven and one of the guides had me do something and now I'm stuck in default zsh. I've tried changing my terminal preferences to be /bin/bash, as well as my ...
beepbeepboop's user avatar
1 vote
0 answers
134 views

WSL run a non-login shell even with `--shell-type login`

Previously running wsl sourced .profile for me, as expected: As of build 16188 when running bash.exe without arguments (or with the ~ argument) bash will be launched as a login shell. The same is ...
Alexey Romanov's user avatar
0 votes
1 answer
30 views

Unable to discard output from redirection followed by &

In the instruction containing a redirection, neither of 1 or 2 or nothing, on the lhs of >/dev/null discards the output, in this case [24] 1073640. This is contrary to my expectation, What could I ...
Erwann's user avatar
  • 141
0 votes
1 answer
54 views

How to extract parts of the international conference video based on spoken language using command line

I have an international conference video which contains two spoken languages, i.e. the video is mixed with sentences of English and Chinese. I would like to remove the Chinese part by command line. ...
John Paul Qiang Chen's user avatar
0 votes
2 answers
166 views

Why is a newly created user account using my personal bashrc?

I set up a home server running Rocky 9 with a minimal install and one user account [mine]. I then created a new user, but when I login as the new user, the bash prompt is using the custom PS1 scheme ...
BlackDiamond's user avatar
0 votes
0 answers
85 views

Run custom shell script through udev

I'm trying to make an udev rule that'll play sound upon connecting the charger. The rule seems to work fine except I can not get the shell script to run. This is my udev rule: $cat 01-mru-battery-...
Abir Halder's user avatar
2 votes
1 answer
659 views

Behavior of SIGINT with Bash

I am running this Bash script: #!/bin/bash for i in $(seq 1 100); do echo $i sleep 1 done When I issue kill -INT <pid> nothing happens -- the script keeps running. If I issue kill -...
rama's user avatar
  • 31
0 votes
1 answer
99 views

What do black (dark grey) files in Debian represent?

I've been racking my brain over this one for awhile now. I have scraped the web and can't find an answer anywhere. What are black (dark grey),font files/file-types in Linux, specifically Debian 12 ...
Druid Monkey's user avatar
0 votes
0 answers
96 views

Bash - autocomplete .bat file

I'm working with MINGW Bash on Windows and run .bat files. My problem is when I type ./<tab><tab> only .sh files are autocompleted. Is there a way to autocomplete all .bat files ?
Chakalaka's user avatar
  • 101
-1 votes
1 answer
91 views

passthru background process sudo multiple commands

Have problem running the command in background. Below is configuration of code. 1] Using php passthru running a command as a different user than current 2] The command has multiple commands to run ...
jd4u's user avatar
  • 107
1 vote
0 answers
92 views

ls in Docker on Windows not showing one directory

I'm running Windows Server 2016 Datacenter version 1607 (build 14393.6614) with Docker Desktop Community Version 2.0.0.3 (31259). I'm running an Ubuntu docker container in an interactive mode with my ...
user1543037's user avatar
1 vote
1 answer
118 views

What does it mean to "run something in a shell profile"

I'm installing Homebrew and I get a message that says: Next steps: ⁃ To add Homebrew to your PATH run brew shellenv in your shell profile (e.g. ~/.bash_profile or ~/.zprofile)" What does it ...
dkv's user avatar
  • 193
1 vote
0 answers
134 views

Issue with Ctrl + Arrow Keys in (Neo)vim using PuTTY

When I establish a SSH connection to my machine using PuTTY, I find that the Control + Arrow keys behave unexpectedly when working with vim or nvim in the bash terminal. For instance, in Vim, escaping ...
N00B_141's user avatar
0 votes
0 answers
228 views

Install a language with ASDF through Ansible on Debian

I'd like to write playbooks to install my development environment. Most steps went well, but I'm struggling to install Ruby through asdf. Playbooks are splitted and called from a main.yaml. The one ...
Sumak's user avatar
  • 109
0 votes
1 answer
77 views

remove duplicate character from string in pure bash - works in CLI but does not work in script

I want to remove all duplicate minuses from a string using pure bash (no sed/awk/etc). This works great in CLI: s="com---strig-3-1080p-----mp4" echo "${s//+(-)/-}" com-strig-3-...
Putnik's user avatar
  • 924
1 vote
0 answers
33 views

Decrypting with gnupg

In Linux, I'm familiar with decrypting .gpg files at the command line. But it seems to me that if I want to save a decrypted file in the same folder from where the unencrypted file was, then I always ...
Paul Benson's user avatar
0 votes
0 answers
40 views

setfacl does not work on files in tmp

ls -ld /tmp drwxrwxrwt 17 root root 440 Feb 3 11:18 /tmp user1@debian:/tmp$ touch acltest0 user1@debian:/tmp$ ls -l acltest0 -rw-rw-r-- 1 user1 user1 0 Feb 3 11:22 acltest0 user1@debian:/tmp$ ...
achille's user avatar
  • 137
1 vote
1 answer
69 views

Runing a command as user is not the same as logging as the user and running the command

I am trying to get a way to execute a script from a root session, but I am having some trouble with it. I'll lay out the issue: I have a script that performs some tasks as the regular user 'kolterdyx',...
Ciro García's user avatar
0 votes
1 answer
77 views

anacron doesnt work as expected

Trying to schedule a job to run every day with cron or anacron. Search the forum for resolution but still without any success. Changing shell=/bin/bash or bin/sh didnt do anything. My system lubuntu ...
Surepic 342's user avatar
2 votes
1 answer
238 views

Running multiple commands in WSL2 / Ubuntu 22.04 from PowerShell

I have to run a chain of commands in wsl from powershell, I've stumbled upon this question while researching, but I cant use && with wsl (wsl "ls && ls" returns with bash: ...
DeNice's user avatar
  • 23
0 votes
1 answer
169 views

Make zsh behave like bash for commands without trailing newline

Have a look at the following demo: [user@host ~]$ zsh user@host:~/ > echo -n test user@host:~/ > bash [user@host ~]$ echo -n test test[user@host ~]$ echo -n is an example for a command, that ...
Daniel Schmitz's user avatar
0 votes
1 answer
90 views

Byobu - modify/pass environment variable in existing session on reattach

I'm experimenting with waypipe recently. I'm creating remote window like this: waypipe -c lz4=9 ssh user@host foot On creating new foot window waypipe denpends on environment variable $...
Kuń's user avatar
  • 1
0 votes
1 answer
161 views

Activate a conda/mamba environment when cd to a specific directory

Can I automatically activate a specific environment when cd into a directory? Like if I cd into the directory my_nn_library then automatically run mamba activate nn_env. I am using Ubuntu.
Osman Mamun's user avatar
1 vote
0 answers
57 views

How to command pv (Pipe Viewer) to work with diff?

using: OS: Kubuntu 22.04.3 LTS x86_64 diff (GNU diffutils) 3.8 Copyright (C) 2021 Free Software Foundation, Inc. pv 1.8.0 Copyright 2023 Andrew Wood, pv = Pipe Viewer commands to display above: ...
joseph22's user avatar
  • 367
5 votes
1 answer
89 views

Less --hilite-unread prints carriage return ^M on blank lines

When printing files with Windows line endings (CRLF), less shows carriage return ^M in blank lines when option --hilite-unread is used. Lines with any text display correctly, skipping the carriage ...
Pawel's user avatar
  • 211
2 votes
0 answers
56 views

Setting GitHub Actions Secrets on Docker container build/run command, but encountering a parsing issue

I'm in the early stages of building an automated pipeline. Still in the exploring phase. Right now, I'm struggling with setting the environment variables for the container I'm going to run my app. The ...
Jorge Mauricio's user avatar
0 votes
1 answer
426 views

Syntax error near unexpected token ('

Please somebody inspect my code to see why I get syntax error near unexpected token (' I have been running this code several time but all I get the same error #!/bin/bash vcf_file_dir="/10/&...
Zizogolu's user avatar
  • 101
2 votes
2 answers
407 views

Linux shell command to replace path with file content

I have a file that includes a relative path in angle brackets, such as the following (example.txt): Some content containing <../another.txt> file Then in the parent directory, the file another....
Jeff G's user avatar
  • 420
0 votes
2 answers
81 views

Find and replace date with UTC date

I have file that looks like this: [2024-01-20 15:23:00] hello world [2024-01-20 15:42:00] bye [2024-01-20 15:43:00] foo bar ... Date in this file are in UTC+1 and I want to convert in to UTC I tried ...
sloppy's user avatar
  • 3
0 votes
1 answer
141 views

How to make bash script output compatible with both terminal and file?

In bash, if I want to produce periodical status messages, I can replace the previous one by emitting a hotkey combination, e.g. as seen here, here or here. When a user executes the script directly, ...
Zsar's user avatar
  • 293
0 votes
0 answers
138 views

Cannot activate Python virtual environment from within shell script (zsh)

I cannot activate a Python virtual environment from within a shell script (zsh). I have tried the following: #!/bin/zsh conda create -n myenv python=3.10 conda activate myenv It sends me the error ...
NilsK's user avatar
  • 155
3 votes
3 answers
652 views

Bash [[ test =~ regex ]] vs perl command result

Is the bash operator =~ equivalent to a perl invocation? filename="test-33.csv" regex="([^.]+)(-\d{1,5})(\.csv)" With bash test: if [[ "$filename" =~ $regex ]]; then ...
rellampec's user avatar
  • 133