Category "bash"

Executing multiple commands with ssh, including evaluation of environment variables on the remote machine

I sometimes use ssh to run multiple commands on a remote host like this: ssh my_user@my_host "command1; command2" utilizing double quotes to send both commands

Add word using sed to the last column of csv

I tried the following sed and even I have set $ to set the path at the end it doesn't seem to be working. Also I dont know if there's any way of execute this li

Escape & character in groovy script while using curl

I'm using bash execution of curl in groovy script: descr = """ curl --silent -k -u test:test "https://bitbucket/rest/api/1.0/projects/test/repos/test/pul

Create folder tree from text file, folder names can contain spaces

I have a text file and I need to create the folder tree with a for loop in a script. Here's the text file I need to use. Animals.txt Animals Animals/Cats Animal

How are strings with multiple kinds of quotes interpreted in bash?

To give context, I'm trying to create a simple version of bash, and for that I need to mimic the way bash parses content with multiple sets of single and double

Convert list of interfaces from show vlan into full name list line by line

I need to take list of interfaces from show vlan: gi1/0/1, gi1/0/2, gi1/0/3, gi1/0/5, gi1/0/7, gi1/0/10 gi1/0/11, gi1/0/13, gi1/0/15, gi1/0/17, gi1/0/19 and ge

bash console output print layout

I want to make my writing to the console output in a nice tidy human readable. here is how it looks now: ====================== Sat Apr 16 12:57:17 EDT 2022 ===

How can I find in a tsv file a value and 2 other values corresponding to the same row but in different columns USING GREP

So I have a tsv file that I opened in Numbers (Mac) and it has this aspect: sequence_id sequence v_call d_call j_call sequence alignment

Copy files with github-action

I am trying to write a GitHub action that makes a copy of a file in my repo into a different subdir in the repo. This is my dir structure (before the file is co

Why can't I start the top command in batch mode, stop it, and then resume it with fg?

I don't know why, so I would like to ask Gen... $ top -b and then Ctrl + Z to stop it, and then bring it back to foreground with $ fg %1 It does not work as des

summarise NA data from datafile on command line in linux / bash

I have a data file with missing values I want to summarise this data and find out how many NA there are in the whole data file and in certain specific cols I ha

How here document works in shell

While doing the input redirection, the shell opens the file on the right side of '<' with file descriptor 0, but in the case of the heredoc there is no such

Environment variables not defined in SSH AuthorizedKeysCommand (Docker)

I'm trying to make the private key SSH connection with LDAP. /etc/ssh/sshd_config AuthorizedKeysCommand /etc/ldap_ssh_authorized_keys.sh AuthorizedKeysCommandUs

How to combine multiple commands output in the one varialble in shell script?

I'm using the following script to get the data of one of the variables from the database file #!/bin/bash sqlite3 pdu.db <<'END_SQL' .timeout 2000 SELECT

BASH : control exits CASE logic after entering any condition - Unable to understand the reason

I have an input file, which has below data : driver2:y driver5:y driver3:n driver1:y driver4:y The requirement is, for each driver if the value is "y" then the

Do you need to include export for environment variables in bash profile / zshrc?

Do you need to include export for environment variables in Bash profile / zshrc? I'm using Z shell (Zsh) for my terminal and in my .zshrc file I have the two li

How to send prompt input to std::process::Command in rust?

I'm writing a cli tool for automate the archlinux installation, that is based on toml config files... Currently i have this problem... Once the base system is i

How to make a pipe conditional within the same line

textfolding="ON" echo "some text blah balh test foo" if [[ "$textfolding" == "ON" ]]; then | fold -s -w "$fold_width" | sed -e "s|^|\t|g"; fi The above code w

How to create and assign a variable name with special character in bash

Sorry if this question is repeated. how can I create a variable a.b and assign a value to it. ---------- root@IN2268980W3:# a=1 root@IN2268980W3:# a.b=1 a.b=1:

Extract tar achives into separate folders

I have a folder containing many tar archives archive1.tar archive2.tar ... I'd like to write a bash script which extracts their innard files to separate folders