Questions tagged as 'shell-script'

1
answer

MySQL Commands in Shell Script

I'm trying to do a routine to deploy an application, and I came across a problem in the shell script, the mysql-related commands I can not execute inside the same, but at the prompt they work, what should be done? > mysql -u sdesk_autoinstall -...
asked by 16.08.2018 / 13:22
2
answers

Logic error shell script

I want to print a message on the screen according to the current time of day but it always falls on the other, what would be the error? I've been to 1h and I do not understand the error.     
asked by 07.07.2018 / 00:08
1
answer

How to enable autocomplete feature for shell script?

I would like the options in my shell script to be displayed or autocompleted when pressing TAB, as with commands like aptitude or yum. How to enable autocomplete feature for shell script?     
asked by 31.01.2018 / 12:51
1
answer

How to protect file upload in php against shell script

How can I protect sending files with php against shell script, knowing that I only accept one type of extension.     
asked by 28.10.2016 / 03:35
2
answers

Replace files with thirst

Hello, I have a problem that I need to solve. I have a file that should be inserted exactly one column from another file, I am trying it as follows: cat $1 | cut -d ',' -f2 | tr "/" "-" | awk -F "-" '{print $2"-"$1"-"$3}' > temp.txt c...
asked by 02.02.2017 / 14:54
2
answers

How to pass a .sh file as a parameter to a code in C?

I need to pass as a parameter to a program in C a file with .sh extension. I already tried it and the value that is read from the file is wrong: ./program ./file.sh How do I get past this argument? Do I need to add anything to make? Thank you...
asked by 27.10.2015 / 12:05
1
answer

Block comments in bash script

I need to comment on a block of code and found the following way it worked: <<COMENTÁRIO meus comentários aqui... ... COMENTÁRIO I would like to know if this is the correct way to do this, I read it on a website and said that the shel...
asked by 12.09.2018 / 00:45
1
answer

What does $ @ mean in shell script?

I'm analyzing some functions in Shell Script and I came across this code: adicionar_usuario() { USUARIO=$1 SENHA=$2 shift; shift; COMENTARIO=$@ echo useradd -c "$COMENTARIO" $USUARIO echo passwd $USUARIO $SENHA echo "$USUARIO (...
asked by 28.05.2018 / 22:42
1
answer

LINUX - how to use a string as a delimiter in the cut command [closed]

How do I use a string in the cut command? already tried with: cut -d"String" -f1 but it says that it is only possible with a single character.     
asked by 05.10.2018 / 13:20
1
answer

How to get the runtime of a program with shell script?

I am creating a basic script in which I would like to get the runtime of a program each time it is called in the script. #!/bin/bash for i in {1..15} do echo "Execucao $i" time ./meu_programa > resultados_nesse_arquivo.txt done But wh...
asked by 04.03.2018 / 17:51