Questions tagged as 'shell-script'

1
answer

How to generate output with colors from shell script bash to file and maintain the colors?

I'm developing a utility in a bash shell script (file.sh), I can generate colors when the output goes to console, for example with a code like: echo -e "\e[1;33m Aqui el mensaje \e[0m"; But my idea is to create a log file as identical as po...
asked by 29.10.2018 / 18:27
2
answers

Obtain hours, minutes and seconds from the date of birth

I do not know if the format of this script is correct or not. I would like to know if I am on the right track and if you could help me in two parameters that I lack and I can not get out. Statement of the exercise: Ask the user date of birth,...
asked by 11.02.2018 / 18:35
2
answers

Find an exact name in a text file with Bash

I am writing a Script in which one of the functions is to search in a text file DNI or Name that the user is asked for and when he finds them he will print the whole lines. The file has the format "DNI | Name" 2:Pepe 21:Julio 1:Marta...
asked by 10.04.2018 / 21:48
1
answer

Absolute path md5sum

#!/bin/bash comprobacion () { fichero=$1; #La variable a almacena el valor actual del checksum a=$(ls -p $fichero | grep -v / | grep -v Script_Md| xargs md5sum); #La variable b almacena el contenido de...
asked by 08.05.2018 / 16:49
1
answer

Return, does not work in scheduled task?

I have a driver in Laravel, which is processed every so often by a task scheduled from the server. This driver does a redirect: return redirect('/control_fich/'.$id_user.'/'.$date_utc); To another controller that continues processing w...
asked by 19.03.2018 / 09:35
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
1
answer

problems when running a shell script, problems in the "if"

Hello, I went to run a shell script in the terminal but I get an error as if I could not accept the condition in the first one (I already gave him the permissions) the exercise says the following: Build a Shell Script called lartc.sh that all...
asked by 27.10.2018 / 22:25
1
answer

Adduser in Shellscript [duplicated]

I have to create a script that can receive up to two parameters: In case you receive 0 parameters the script has to show the login of all system users. In the case that it receives 1 parameter if parameter 1 is "-h" that shows a help or...
asked by 13.05.2018 / 15:30
4
answers

Folder permissions on ubuntu

Hi, I have an installation with ubuntu where I'm going to use apache as a web server. For this I have created a folder in / var / www / html / tests Where I created a series of files for example "index.php" The problem I have is that if...
asked by 17.11.2017 / 17:02
2
answers

How to compare a variable with a string in Shell Script?

I'm trying to compare a variable with a String but I have not found a way to do it, the variable is the result of a function, which result can be "Terminal" or "Server", which I can print without any problem, the problem is that I can not find a...
asked by 27.09.2017 / 23:23