Questions tagged as 'shell-script'

1
answer

How to insert value of a query into a variable in Shell Script?

I have JSON in a file nomes.txt . JSON is: {"p": { "nome": ["josé","Maria", "carlos","Artur"] }} I want to throw the query value of it into a variable. Show the results: #!/bin/bash ns='cat nomes.txt' echo $ns...
asked by 05.09.2018 / 15:52
2
answers

How to get exit code from a command block

Suppose I have the following commands in a script susd systemctl status firewalld If I look at exit code through echo $? it returns 0 because the last command was executed successfully, but how can I get the exit code o...
asked by 03.08.2018 / 01:18
1
answer

How to create a ZIP file in the Shell? [closed]

How do I create a ZIP file in the Shell with today's date files? The files are all in the same directory.     
asked by 18.06.2018 / 22:35
1
answer

Why nohup does not accept for loop?

I have this code inside a file called test.sh When I try to run nohup ./teste.sh &  he gives this error. Can anyone explain me? ./ teste.sh: 9: ./teste.sh: Syntax error: Bad for loop variable CODE cuda="cuda.out"; cpu="cpu.out"; cuda...
asked by 16.06.2018 / 19:10
1
answer

Compare two files using Shellscript

I have a number of data collectors connected to a service. This service is provided by third parties and I do not have "admin" access to create the queries in my interest. The only way to know if these collectors are active is via a URL that ret...
asked by 22.03.2018 / 19:10
1
answer

Put flag at bash shell command line

I'm trying to put a flag that can sort or shuffle the output, but I could only do that in code and intended it to work when I put the flag on the command to run the file, for example ./bash.sh -r .     
asked by 02.01.2018 / 22:34
0
answers

syntax error near unexpected token 'fi' [closed]

I'm new and I'm having problems with the script below: echo "Enter an A, B or C" read letter if [[ $letter == "A" || $letter == "a" ]]; then echo "this is A" elif [[ $input == "B" || $input == "b" ]; then echo "this is B" elif...
asked by 09.12.2017 / 05:32
1
answer

Every round loop exchange var

I'm developing a shell system that has a form for adding some fields. Product Quantity Unit Value etc ... I need every time I loop the loop to change a variable, so I call it on the form! In case it is prev, every round it switches to p...
asked by 26.09.2017 / 19:03
0
answers

Linux script to send e-mail from the result of the find command [closed]

I need a help in a script to send a result by email from a search (find) and run every day at 08:00 without using contrab in linux     
asked by 13.06.2017 / 14:49
1
answer

Help with script to draw routes

I am creating a script similar to tracerouce, when I type an IP it traces the route of arriving at the final destination, but when the route reaches the destination, the while still continues, as I correct this problem, stop when I reach the des...
asked by 08.05.2017 / 03:31