Questions tagged as 'bash'

1
answer

Verify that the process is running without encountering a limit of 15 characters

With the following code we check if a certain process is running: #!/bin/bash #Verificar se processo abc está em execução if pgrep "abc" >/dev/null 2>&1 then printf "Está em execução.\n" >&2 else printf "Não est...
asked by 07.11.2014 / 18:34
1
answer

Epoch timestamp file name conversion to date

Expensive; I have a list of files (140,000) dated in the format Unix epoch timestamp in the filename. I need to convert each file to match its actual date by changing its name. Example: 1475279740.15044_xxx.xxx.stats, where the epoch timest...
asked by 19.10.2016 / 22:27
1
answer

Define multiple variables in just one row

I would like to make a parser with just one line and break a string into several variables. In the string I will parse, the default is that each field is separated by a comma. On several lines, the code to do what I want would be like this:...
asked by 03.03.2014 / 18:49
1
answer

How to make a script accept autocomplete in bash script?

Let's say I have a script that asks for a user input as shown below Digite o caminho do arquivo: How do I make this input autocomplete the directories path in linux? I need this to avoid typing errors     
asked by 13.07.2018 / 03:52
0
answers

Passing result of compare -metric to variable - Picture from IMAGEMAGICK

I'm comparing two images using ImageMagick on the LINUX Terminal. When I type in the terminal line this (below) it returns me a value: $ compare -metric mae 0.jpg 2.jpg null: But I can not put this value in a variable and then make a com...
asked by 18.12.2017 / 04:30
3
answers

Grep with multiple parameters

I need to select the rows of a file that contains the characters | or \ diff -y ontem.csv hoje.csv | grep -e "|" -e "\" How to tell pro grep to return the rows it contains either a | or a \ ?     
asked by 05.07.2018 / 19:49
0
answers

Linux Script - Search, Copy, Paste and Change file values te texto [closed]

I have these 3 files: Access.txt : Large text file with records per row and columns separated by " ; ". < br> NewAcess.txt : List of new hits to add. NewUsers.txt : List of new users to add. Sample Files:...
asked by 08.04.2015 / 20:02
2
answers

Execute bash commands in C

I am using the system("comando"); function to execute bash commands in a program in C. However, I'm having trouble printing the value of a variable. #include <stdio.h> #include <stdlib.h> int main(void) { char* letr...
asked by 04.07.2018 / 03:27
1
answer

How to search for an exact word with the grep command

Well, whenever I use the grep command it looks for a word that contains the desired word + anything, how can I make it understand that I just want that word and nothing else? ex: ps aux|grep bc Instead of looking for it ...... bcache .......
asked by 15.07.2018 / 00:04
3
answers

Delete the .bashrc, .bash_profile, and .profile files: what are the consequences?

I've been trying to install Ruby and Ruby on Rails through RVM but during the installation process I had some problems. I tried to uninstall RVM through the commands: rvm implode gem uninstall rvm After performing these commands, I...
asked by 27.02.2014 / 23:06