Skip to content

Tag: shell

How to get next param in linux shell command params?

I’m writing a shell script of this command: For ‘-w’ options, I want to process ‘/test.pcap’ into ‘$PWD/test.pcap’, so I write script like this: As we see, I want to get ‘/test.pcap’ by ‘$OPTARG’, but is none. So my question is how to get &#821…

how can i cut one line on two on a cat /ect/passwd?

I’m trying to write a command that shows all odd lines of /etc/passwd: I’ve tried: but it didn’t work Is there a different way to obtain the result? Answer The step syntax is a GNU extension. sed ‘n;d’ should be the portable version of your sed invocation.

Show all sourced files in ZSH

I want to see which files got sourced while starting the Z-shell. Does it even keep track and if yes is there a way to list all the files? Answer You could do a at the beginning of the very first file which gets sourced. See man zshoptions.

Unexpected behaviour of double quotes in bash script

I’ve created a variable which looks like this: If I print it to the terminal, using echo $firstAndLastLines, I get the following output: root bin daemon adm lp Privilege-separated SSH Account used by the trousers package to sandbox the tcsd daemon Norbert Fogarasi But, if I use echo “$firstAndLast…

sudo doesn’t work, but root user works [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 …

space issue between Month and date in linux

In my linux system date is having two space between month and date(ex:Jun 4) .so i used date command(ex:date +’%b %_d %H’) and stored the value in variable that time i am getting only one space between month and date(ex:Jun 4), so please help me to get the actual system format while using variable…