« first day (553 days earlier)      last day (2512 days later) » 

4:10 AM
@simplycoding to redirect to stderr, that's >&2
or more generally >&*n* to redirect to an already-open file descriptor numbered n
so echo "$0: error, too many foobars, exiting" >&2
the convention to prefix all error messages with the name of the command which produced them is not universal, but very useful
I usually define me=${0%%*/} at the beginning of the script so I can say echo "$me: failure" >&2 without the path stripped off
 
 
2 hours later…
5:54 AM
@Queen k
 
6:21 AM
@tripleee Warning: stunnel-X.Y.Z already installed, it's just not linked .... This is a shell script response from terminal that is displayed
 
what's the context? looks like you want to install stunnel
brew link --overwrite stunnel
 
 
3 hours later…
@Queen k
 
 
3 hours later…
12:25 PM
@tripleee yes I want to run the command brew link --overwrite stunnel but through shell script how can I check if [terminalresponse == it's just not linked] then overwrite stunnel command
 
12:47 PM
hi
can anyone help me here?
 
 
3 hours later…
4:42 PM
@TusharSharma if you ask an actual question, we can try; but as you can tell, no immediate response can be guaranteed
@icodes hard to tell without an actual script but try case $(brew install stunnel 2>&1) in *'just not linked'*) brew link --overwrite stunnel;; esac
$(command) expands to a string containig the output from command and the 2>&1 redirection takes care to include standard error into the captured string
ideally, brew would terminate with a specific error code in this scenario and you could script that for improved portability and robustness
perhaps something like if brew install stunnel; then echo success >&2; elif [ $? = 123 ]; then brew link --overwrite stunnel; else echo something went wrong >&2; fi
(pardon any typos; I'm on mobile)
 
 
2 hours later…
6:41 PM
is proper way to set env variables by export varname="varvalue"?
or env varname="varvalue"? Afraid to test and try it since I don't want to mess anything up
nvm, found the answer
 

« first day (553 days earlier)      last day (2512 days later) »