Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My Shell script include series of steps for example first step

App=  read -p "### Please enter Application name " 
Env = read -p "### Enter Enviornment name (Dev,test)"

second step

cd /opt/Weblogic/
mkdir $App
mkdir $Env

Third Step

cp /tmp/weblogic/* /opt/weblogic/$App/$Env/*

So my question is how can I record what user is entering each time? Is there a way I can store the user the whole input and output to something call temp.txt? This way I can review to find out which user has enterred which input.

I hope my question is clear.

share|improve this question

You could wrap it all in a subshell and tee or tee -a to output to temp.txt.

e.g.

(
read -p "### Please enter Application name " App
read -p "### Enter Enviornment name (Dev,test)" Env
echo "App: $App"
echo "Env: $Env"

cd /opt/Weblogic/
mkdir $App
mkdir $Env

cp /tmp/weblogic/* /opt/weblogic/$App/$Env/*

) | tee -a temp.txt

The -a on tee will append to the temp.txt for each execution. You can remove it if you want it to start fresh each time.

share|improve this answer
    
Thanks very much Zachary it worked :) – Manish Nov 18 at 20:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.