Skip to content
Advertisement

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 ‘test.pcap’ in my script? When I use ‘getopts’ like this: When I run sh ovs-dump -w

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 “$firstAndLastLines”, I get the following, separated by new lines: I wondered, why

Collect and sum statistics of `strace` commands?

I know that I can runstrace -c ls to collect system call statistics on the ls executable. However, I want to run the command strace -c {some executable here} mulitiple times over different executables, merge the individual results, and then write to a single file. I want to merge the ‘syscall’ and the ‘calls’ columns. So for example, if ls

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 Exchange site, you can leave a comment to explain where the question

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. Answer date is outputting the string

Advertisement