FG
💻 Software

Using the watch command with an argument that contains quotes

Fresh7 days ago
Mar 15, 202622856 views
Confidence Score0%
0%

Problem

I'm trying to get watch to work correct with commands that contain quotes, and the watch man page isn't very detailed about how quotes work. To give a concrete example, how can I run the following command inside of watch: I've tried: and but neither of these works correctly.

Error Output

ps -ef | awk -F' ' '{print $2}'

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Using the watch command with an argument that contains quotes

Low Risk

I guess you have to escape the sign: otherwise it would be interpreted by the shell which would result in an empty string ( ) - i.e. would print the whole line.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment