0

i am trying to capture the output of the command fuser into an array in shell script. based on other similar queries I used below lines in shell.

p_list = ( $("fuser -m /mnt/usb") )

But i am getting below error

./capture.sh: line 8: syntax error near unexpected token `('
./capture.sh: line 8: `   p_list = ( $(fuser -m /mnt/usb) )'

The fuser output is the process list using the above path as below

~# fuser -m /mnt/usb
9261 1089 8526

Why is this issue? Any hints. How to i achieve this.

1 Answer 1

2

As with any assignment in bash: no spaces around =.

p_list=( $(fuser -m /mnt/usb) )
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I had to remove the quotes (") around the command to make it work. p_list=( $(fuser -m /mnt/usb) )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.