Questions tagged as 'bash'

1
answer

Why does this script mark that the service has not been found? [closed]

This is the script that I am using and the only thing that marks is [o: not found #!/bin/bash control=0 while [ $control != "1" ]; do clear service='ps awx | grep 'isc-dhcp-server'|grep -v grep |wc -l' if [$service==0];then estado="OFF...
asked by 23.04.2018 / 21:54
4
answers

Use two variables in the output of a bash script

I'm doing a simple%% co to be able to do directory backups, but I want the resulting file name to be script . I have the following code. #!/bin/bash clear ls -d */ echo "Elige el directorio del cual hacer el backup (sin incluir el /)"...
asked by 21.06.2017 / 00:36
3
answers

Execute MYSQL in a bash script

Greetings community I hope you are well. I have a problem, I want to run a few MYSQL statements but as BASH , I need to run this on ubuntu. I have created a file called scripts.sh where I have placed the sentences to execute:...
asked by 17.12.2018 / 22:51
1
answer

How to check if there is a word in a file

I have the following file in centos: I want the program to check if there is "equipment" with a regular expression like it would be with the sed command ???     
asked by 01.01.2019 / 14:39
2
answers

Bash script in which you enter numerical value and execute with that value

I have this little script in Bash to raise or lower the brightness of my laptop: #!/bin/bash clear sudo tee /sys/class/backlight/radeon_bl0/brightness <<< 10 In which "10" is the numerical value to change. My question is: How do...
asked by 20.08.2017 / 06:02
2
answers

Error: Too many arguments

I need to compare all the words that I pass as arguments between them, and say if they are the same or not: #!/bin/bash #Ejercicio_4 if [ $# -ne 6 ] then echo Número de argumentos incorrecto else if [ $1 == $2 == $3 == $4 =...
asked by 29.12.2018 / 02:23
1
answer

Create MySQL database from script in bash ubuntu 16.04

I would like to create a database using a script that I already have, in MySQL from the bash of ubuntu 16.04, the script is the following -- Creamos la tabla si esta no existe CREATE DATABASE IF NOT EXISTS platzi; -- Indicamos que trabajaremo...
asked by 25.02.2018 / 18:06
1
answer

Comment a line in a file.log separated by blank spaces? [duplicate]

file.log if $programname contains 'file_apps_' then @233.33.3.3 $ModLoad fdsf #File APPS - j_d action(type="dfsfdsf") $InputFileName /logs/.log $InputFileTag ja_dd_d $InputFileStateFile jas_dd_d $InputFileSeverity info $InputFileFacility...
asked by 20.12.2018 / 21:07
1
answer

Query with sed bash script string

I have the following example: cat test.txt Showing the following:    juan maria juan maria juan maria maria juan maria juan maria juan   roberto roberto roberto roberto roberto roberto To separate 2 from 2 each chain I do it using...
asked by 10.11.2018 / 13:21
1
answer

Problem with linux console

I am trying to access a folder on my desktop that contains the key to establish the ssh connection with the aws instance. I have installed the ubuntu bash for my windows system (since I have seen that with the windows console the connection c...
asked by 05.11.2018 / 18:30