Questions tagged as 'shell-script'

4
answers

Count the number of times a character appears in a string

I need to count the number of times a character repeats in a string . For example: How many times does the / character appear in the string below?    '/ file / program-files / test / dev / dev1 / Central.pdf.gz' This string will...
asked by 21.10.2016 / 17:18
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
2
answers

What is the dollar sign used for before a variable?

I would like to know the function of the dollar sign, and also if it is necessary that the variable be glued (without any space) in the equal sign (=) and the value of the variable (GABRIEL) example: NOME="GABRIEL" echo $NOME     
asked by 10.02.2017 / 03:50
2
answers

Ignore the first line

I am using the following command to organize a file: sort -u arquivo.csv -o arquivo.csv But I need to ignore the first line of it, in this case the header. How can I do this?     
asked by 05.06.2018 / 19:15
2
answers

Renaming files recursively according to standard given in Linux commands

I'm trying to rename files by replacing certain conforming patterns, but I wanted to do this job recursively and still could not. - / doc | ----- text1.txt | ----- texto2.txt | - / doc2 _ | ----- text1.txt _ | ----- texto2.txt...
asked by 27.10.2014 / 02:07
3
answers

Create file with execute permission

When I create file .sh , I need to give permission for it to be executed, is there any file that can be configured or comando applied so that I can already create the file with execute permission?     
asked by 12.06.2015 / 17:15
1
answer

Automate a .sh script

I have a Shell Script (.sh) and need to automate it. Could someone help me ?? This script, copies data from a folder and sticks (converting to another format) into another directory, runs a Python script for plotting data, and updates the inf...
asked by 20.11.2017 / 17:13
1
answer

PHP run sudo command with shell_exec () [closed]

I have the following problem, I'm trying to run a sh file with php using shell_exec for example: echo shell_exec("./example etc etc"); My problem is that it does not run, is it some permission problem? When I type: php x.ph...
asked by 11.11.2016 / 01:12
2
answers

Copy directory from one ssh server to another

I need to copy a directory to a server with a script .sh running on another server. I read about the scp command and I saw some usage examples, but I did not figure out how I put the password of the server I'm accessing to copy r...
asked by 05.08.2016 / 14:56
2
answers

Unexpected exit

I'm running this command to remove repeated lines from a file: cat arquivo.csv | (read;echo "$REPLY"; sort) | uniq > arquivo.csv But when I look at the file, it is blank rather than just the lines that do not repeat themselves. What am I...
asked by 18.05.2018 / 18:41