Questions tagged as 'shell-script'

1
answer

Use of% in variables

I can not understand what this symbol is for in a variable, I see its use in some points in SQL code, Shell Script, C. What is the use? For example a use of this symbol in Shel Script: DATA=$(date +%H) The variable DATA receives t...
asked by 14.05.2017 / 18:54
4
answers

Variable interpolation in shell script that returns the output of a function

I've solved a problem with a larger script I'm producing. Basically I have a function that returns the current date and time in a specific format. I need every time the variable data_hora is printed on the screen, its values are updated f...
asked by 28.12.2015 / 03:43
1
answer

Checklist and Dialog with external file - Shell Script

I need to use Dialog doing a Checklist from an external file, so far I've done the following: dialog --stdout --checklist "Contas de e-mail: " 0 0 0 \ while read line do $line "" on \ done < contasemail.txt But I'm getting the f...
asked by 26.09.2017 / 15:57
1
answer

Shell script function

I have a VM and need to run a script remotely in another VM, for example: Script is in VM X and must be executed by X in VM Y. #!/bin/bash IP=$1 if [ $# -ne 1 ]; then echo "informe o servidor $1: " exit fi for machine in $1; do ssh...
asked by 08.02.2016 / 17:05
1
answer

Automate enter input on command line while executing a bash script

I created a bash script to automate the installation and configuration of my environment needed to run my project, but some of the tasks require that the actions be confirmed by entering enter, I would like to know how I can automate this input...
asked by 01.11.2016 / 18:24
1
answer

Regular expressions with 'grep'

I need to extract data from a text and I'm trying to do this using grep. But the way to make use of regular expressions with this command are quite different from what is usually done in Ruby or JavaScript, and I am not able to do what I need. I...
asked by 02.04.2015 / 23:13
1
answer

Diff changing rows

I'm comparing two files, which are updated daily, with the diff -y command in order to get two results: The first are the lines that have been modified from one day to the next: grupoAzul;Gabriel;04-maçãs;02-limões | grupoAz...
asked by 31.07.2018 / 17:58
1
answer

Show contents of a file by opening the file with the content string of a variable

I have a problem to show the contents of a file using the following command: variavel="Affonso\,\ I.\ P..txt" cat < "$variavel" And running the same command on the terminal but without using a variable, it usually works like the followin...
asked by 29.07.2016 / 15:57
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
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