Questions tagged as 'shell'

2
answers

Find and Replace Various Word Within a File

I want to develop a script that will replace any words in file . I know what I can do with the command (s) below: $ tr 'ABC' '123' < arquivo.txt > novo-arquivo.txt or $ sed "s/ABC/123/g" arquivo.txt > novo-...
asked by 05.10.2016 / 06:48
2
answers

Hide error messages

Consider the following shell script: ping 8.asd.8.8 -c1 -q > /dev/null if [ $? == 0 ] then echo 'ok' else echo 'erro' fi This ping will return an error and this error is handled in else just below. But even using the -q pa...
asked by 16.09.2016 / 02:24
3
answers

How to call external command with Python?

How can I call an external command in Python, as if it were executed in the Unix shell or at the Windows prompt?     
asked by 21.08.2014 / 17:50
2
answers

Delete character in a certain position?

How do I delete a particular character in a particular position in the shell? I've tried with sed , but I can not put the position too, just the default. ",45123","B23142DHAS675" What I wanted was to delete the , that is in...
asked by 30.04.2014 / 21:24
1
answer

Shell send error message

I have a cron job running that calls a shell script. This sh file backs up the database and saves it to a folder on the server. That's working. I know that at the time of generating the backup and / or save an error may occur. I would like to...
asked by 26.02.2014 / 19:50
1
answer

Problem with 'echo -e'

I'm starting to learn shell script and am doing some simple scripts to train. The script below tests whether anyone running the script is logged in as root. # !/bin/bash # # This script test if you are the superuser if [ "$(id -u)" = "0" ];...
asked by 14.08.2014 / 01:45
2
answers

How to get the number of processors and cores through the terminal?

How to check the number of processors (CPUs) and cores by the Linux terminal?     
asked by 09.06.2015 / 17:37
2
answers

Concatenate SH command results in one line

I'm starting to learn Shell Script and got with a doubt. I am creating a .sh to get the number of processes running in the OS and exporting this information to a .csv file. The problem is that I would like to save the results all i...
asked by 23.08.2018 / 20:58
1
answer

What is the difference between & e && in SHELL?

I'm using the Ubuntu Terminal. I learned a certain command to be able to free memory, which is: free & sync In another case, I learned something like nohup && After all, how are these two operators called ( &am...
asked by 25.08.2015 / 15:32
2
answers

How to give automatic permissions in shell script

I have a project that whenever I go up for production or change of development machine I copy and paste the whole folder, but every time I do this I have to give permissions in this folder and in some sub-folders. I would like to create a scr...
asked by 14.03.2014 / 19:31