I have a directory that have multiple subdirectories with git repositories. I want to add desktop.ini
to all .gitignore
files in these subdirectories.
I know i can do echo "desktop.ini" | tee -a .gitignore
, but it does not work recursively.
I have a directory that have multiple subdirectories with git repositories. I want to add desktop.ini
to all .gitignore
files in these subdirectories.
I know i can do echo "desktop.ini" | tee -a .gitignore
, but it does not work recursively.
I ran the command time echo "Hello world" | tee output.txt
expecting to get the full output to both terminal stdout
and the output.txt
file. However, the file content is not what I expect :
Expected file content:
Hello world
real 0m0.000s
user 0m0.000s
sys 0m0.000s
Actual content:
Hello world"
can anyone help ?
I'm using tee
as follows:
some commands | tee -a >(command1 >> file) >(command2 >> file) >(command3 >> file)
How can I delay the execution of command2 till command1 ends, and same for command3 and command2? I tried using wait
like this, but it didn't work:
some commands | tee -a >(command1 >> file) >(wait command2 >> file) >(wait command3 >> file)
I am trying to replace value in the file of constraint_0_power_limit with new value using echo "45000000" | sudo tee constraint_0_power_limit_uw
That file is under /sys/class/powercap/intel-rapl/intel-rapl:0/
When I use above command, I get tee: constraint_0_power_limit_uw: No data available
error.
How can I fix that error?
The input file of a script is passed as an argument from command line. I want the log file from tee to be saved in the same directory than the input file:
Lets say that input file is at "data/temp/inputfile.txt"
This is the part that is giving me problems:
{
INPUT1=$1
#Save each subdirectory as an element of the array
bkpIFS="$IFS"
IFS='/' read -r -a inputstring <<< $INPUT1
IFS="$bkpIFS"
#Get number of levels
PATHLENGTH=${#inputstring[@]}
if [ PATHLENGTH > 1 ]
then
#Delete the input file from path
FILEONLY=${inputstring[-1]}
INPUTFOLDER=${INPUT1/%$FILEONLY/}
#Name the log file
LOGFILE="arrays.log"
LOGPATH="$INPUTFOLDER$LOGFILE"
else
#If input file is at working directory
LOGPATH="arrays.log"
fi
# Here goes the main script...
printf "\nDone!\n"
} | tee $LOGPATH
I'm just getting an empty file named "1" at the working directory. Of course if I write in the last line:
} | tee arrays.log
everything goes well, but I need each log file in the same place than the input file.