You are not logged in.

#1 2012-08-23 12:40:54

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

[Solved] Bash: Want to supress output but still have it recorded

I'd like to run a test, have it known but the output not to show.  How do I do this?

[[ -z $(ls -1 screencast-[0-9][0-9][0-9][0-9]*) ]] && echo hi

If I send it to /dev/null it doesn't get recorded, what do I do?

Last edited by Gen2ly (2012-08-23 14:08:00)


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#2 2012-08-23 12:42:23

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [Solved] Bash: Want to supress output but still have it recorded

Send it to a file - or a variable.

*think I must be missing something*

Oh, after reading better I think I get it, though the answer would be the same.  Do you only want the return code of the command used for the test while other output is ignored?  Various options depending on your need:

commmand >/dev/null
[[ $? -eq 0 ]] && conditionally-executed-command

[[ `command >/dev/null` ]] && conditionally-executed-command

command > ~/my.log

VARIABLE_LOG=$(command)

Last edited by Trilby (2012-08-23 12:46:26)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2012-08-23 14:07:44

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [Solved] Bash: Want to supress output but still have it recorded

Oy, was up late smile, I couldn't see through the fog with my blunder.  Thanks for seeing through it though, exactly what I needed.


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

Board footer

Powered by FluxBB