Category "shell"

Gitlab Shell Script Permission Denied

I am running a simple shell script with Gitlab CICD and I am getting Permission denied. Kindly suggest When I do chmod +x test.sh it says operation not permitte

Linux Command , how to find files by size larger than x?

I'm trying to find files with size larger than "x" , ex: 32 bytes But what I found in ls --help was only ls -S , that just sort by size and not satisfied my d

What are the differences between a login shell and interactive shell?

What is a login shell and interactive shell, and what is a .bash_profile and .bashrc?

How to check if a user disconnected, if it's a new disconnection and the server on which the action was made?

I have to create a shell program, such that each time certain users (given as parameters) connect/disconnect from the system, it will save in a text file if its

git shell command doesn't work with IdeaVim

I'm using intelliJ for IDE and installed IdeaVim. I'm trying to execute git status inside vim but it didn't work and nothing to show. :! git --help and :! ls

How to write a single line shell script with a while loop and if statement

I am trying to figure out the syntax for having a while loop and an if statement that checks for more than one condition, in a single-line shell script. Execut

-bash: __git_ps1: command not found

I tried to install Ruby 2.0. My command line urped and now looks like the following: -bash: __git_ps1: command not found [11:58:28][whatever@whatever ~]$ I

Using sed to replace tab with spaces

I'm trying to replace the tab with 4 spaces, using sed, but it is not working. Here is my code: sed -i '{s/\t/ \{4\}/g}' filename Any suggestion is apprecia

Concatenating variables in Bash [duplicate]

I am trying to add a variable to the middle of a variable, so for instance in PHP I would do this: $mystring = $arg1 . '12' . $arg2 . 'endoffi

How to detect array start index by current shells (zsh/bash)?

We all know arrays in Bash are indexed from zero, and in zsh are indexed from one. How can the script know it should use 0 or 1 if I can't ensure the running en

How to detect array start index by current shells (zsh/bash)?

We all know arrays in Bash are indexed from zero, and in zsh are indexed from one. How can the script know it should use 0 or 1 if I can't ensure the running en

How to use sed to remove the last n lines of a file

I want to remove some n lines from the end of a file. Can this be done using sed? For example, to remove lines from 2 to 4, I can use $ sed '2,4d' file But

How to prevent docker container from stopping after executing sh script file

im running a docker container as shown below, after the sh files are executed the container terminate by default, how i can keep the container working in backgr

I just assigned a variable, but echo $variable shows something else

Here are a series of cases where echo $var can show a different value than what was just assigned. This happens regardless of whether the assigned value was "do

How do i replace [] brackets using SED

I have a string that i am want to remove punctuation from. I started with sed 's/[[:punct:]]/ /g' But i had problems on HP-UX not liking that all the time

Run multiple python scripts concurrently

How can I run multiple python scripts? At the moment I run one like so python script1.py. I've tried python script1.py script2.py and that doesn't work: only t

Pipe a vim command after a shell command

I'm trying to make a key mapping in vim that (a) saves current file (b) performs a git action, using shell (c) quits current vim editor. I've tried the followi

Jenkins shell script returned exit code 1 when the searched string isn't exsist

I'm tring the following at Jenkins in aim to search strings of failures in jobs. This will run on daily basis. def sd = "2020" + "${env.START_DATE}" + "0000"

How to get last command run without using `!!`?

I'm trying to alias _! to sudo the last command, but I'm running into roadblocks. !! doesn't seem to work in my .zshrc file, and sed has given me repeated probl

Recursive copy of a specific file type maintaining the file structure in Unix/Linux? [closed]

I need to copy all *.jar files from a directory maintaining the folder structure of the parent directories. How can I do it in UNIX/Linux term