Questions tagged as 'bash'

2
answers

Correct invalid command dynamically, without aliasing

I'm using GNU bash version 4.3.46 . One problem I have when typing commands is that I often forget a space between the command and its parameters. Examples: cd.. gitlog When the correct one should be cd .. and git log , res...
asked by 21.05.2018 / 14:44
2
answers

How can I change the file extension recursively in GNU / Linux?

I'm trying to get all the .sql files from my project and change the extension to .md . I've already been able to do this, however, the files are being moved to the root of the system, which is the path where the shell script is. How...
asked by 21.11.2018 / 14:03
1
answer

I can not clone repository with git bash

I wonder why I can not clone a public repository of Github with git bash. I give the command git clone plus ssh or https,  but it gives the following message:    Permission denied (publickey).     fatal: Could not read from remote repo...
asked by 27.07.2017 / 19:05
1
answer

How to sort a column of a file without sorting the rows?

I have a file that has three columns, and several rows. The second column is made up of numeric values, and I want to rearrange it, in ascending order, but without affecting the previous and subsequent column. exemplo do arquivo: 7.31937 736...
asked by 11.10.2016 / 15:29
2
answers

Copy (cp) to the current folder in LINUX [closed]

Is it possible to exempt target path by giving a command to copy (cp) in the linux console to the current / current folder? Ex: cp ~/Origem ~/Destino What I want is some shortcut in bash equivalent to the target. Ex: cp ~/Origem...
asked by 13.09.2015 / 05:43
1
answer

Go through a bash script array

Can anyone give me an example of an if and case traversing an array in bash script? I'm just setting an example with for what's to list the items .. I'm trying this way but it's not right. ex: v1=("sim" "s" "y" "yes" "") v2=("não" "no" "nao")...
asked by 08.07.2018 / 03:41
1
answer

Edit configuration file

I have a configuration file with several parameters, for example: campo1=valor campo2=valor campo3= I would like to assign a value to campo3 with Shell Script. I tried to awk but could not. The value to be replaced will hav...
asked by 17.08.2018 / 20:16
2
answers

Find and Replace in bash

I need to find outdated rows in a csv file and replace them with new rows. These are the commands that find the lines that are going to be replaced (old) and that will replace (new) lines. linhas_antigas=$(diff -y arquivo_com_linhas_antigas...
asked by 21.06.2018 / 20:12
1
answer

How to create, access and manipulate associative arrays?

I'm using GNU-Bash in my MingW terminal (% with%). I need to create a data dictionary to check if a new key was found and associate this new key with an index. For this, I think the best solution would be an associative array. However, I can...
asked by 26.01.2018 / 04:17
4
answers

Make one copy at a time from the source file, to the destination files

A new need arose accompanied by a good new question that until then I did not find anything similar on the internet - Copy a single line at a time, for a single different file . Example for each new line to be copied: total=10 linha='ca...
asked by 02.02.2018 / 13:36