Skip to content
Advertisement

Tag: sh

How to iterate over two arguments in the sh linux shell

I have two sets of arguments: a = “5 7 1” and b = “dogs cats horse” They should come in pairs: 5 matches dogs, 7 matches cats and 1 matches horse They also should do this in one line: The problem is that the $a and $b can have hundreds of arguments, so writing many lines like the above

how to search a file only in user profile and root in linux/unix [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question

Can`t call command with variable on sh file using ssh

I have the script on centos 7 server for kill process by used id: Above script works fine when it is called from the server. But my goal calls this file using ssh from my local machine like: But I git this error: Answer you need to install lsof on the remote server. or try to add the full path

List and change directory and run command in Shell

I am coming back to shell after almost 6 years or so. I have a directory structure let’s say, MainDirectory –> subDirectory1/some.xml                      –> subDirectory2/some.xml                      …                      …                      –> subDirectoryN/some.xml And I want to execute some.xml in all the subdirectories and get the output to a file using “>” operator I guess. What would be the proper script for this? I tried

How to grep within a loop to exclude?

I have a NPM_RESERVED_SCOPE that contains a comma-separated list of forbidden scope. I have a NPM_ALLOWED_DEV_DEPENDENCIES_PACKAGES that contains a comma-separated list of exception. I want this script to passe if the devDependencies does not contains any of the NPM_RESERVED_SCOPES, except the list of exception. This is the file package.json How can I do? Answer Convert the lists into extended patterns

Advertisement