Skip to content

Tag: shell

Provide windows avilable cores

I use the following in my script to find how many available cores I can use. This is for Linux: This is for Mac (darwin): How should it be in Windows? Answer You can use one of those commands: (here you have two physical processors) Or as suggested in comments: In Makefile the record should be something like:…

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 excepti…

Use environment vars with head

I need to use some vars in a script where I use tail and head, my script works when I type it in the terminal but when it is in a .sh file I get this error from the head command: The error comes from this pipe of my script: I tried using variables in another script where only declaring

Replace string pattern with a string in linux file [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago. Improve this question I am a newbie to Linux. Need to replace With using sed or some alternative…

sed for print two different word alernatively

I have a requirement to print two different words in alternative white spaces in the file. For example, The above scenario, I want print ab and /ab alternatively like below: *I want this one by one in a line by line format(Not horizontal format).*I know sed ‘s|^[[:blank:]]*$|</ab>|’ this com…