Skip to main content
Tweeted twitter.com/StackCodeReview/status/1528254369099091968
edited tags
Link
Mike
  • 309
  • 1
  • 5
Became Hot Network Question
added 735 characters in body
Source Link
Mike
  • 309
  • 1
  • 5

Update: I also wrote a test for this program, I would like you to give me feedback about it as well. How can I improve it

#!/bin/bash

# get the testing utilities

. $(dirname "$0")/testutil.sh

CMD="tee"

# test for stdout only
run_test "tee stdout only" < file.txt

# test for stdout and a directory 
run_test "tee stdout and directory" .. < file1.txt

TEMP_FILE1=`mktemp`
TEMP_FILE2=`mktemp`

# test for stdout and multiple files
run_test "tee stdout and multiple files" $TEMP_FILE1 $TEMP_FILE2 < file1.txt

# test for stdout and inaccesible file

chmod 000 $TEMP_FILE1 
run_test "tee stdout and inaccesible file" $TEMP_FILE1 < file1.txt

# cleanup

rm -f $TEMP_FILE1 $TEMP_FILE2 

Update: I also wrote a test for this program, I would like you to give me feedback about it as well. How can I improve it

#!/bin/bash

# get the testing utilities

. $(dirname "$0")/testutil.sh

CMD="tee"

# test for stdout only
run_test "tee stdout only" < file.txt

# test for stdout and a directory 
run_test "tee stdout and directory" .. < file1.txt

TEMP_FILE1=`mktemp`
TEMP_FILE2=`mktemp`

# test for stdout and multiple files
run_test "tee stdout and multiple files" $TEMP_FILE1 $TEMP_FILE2 < file1.txt

# test for stdout and inaccesible file

chmod 000 $TEMP_FILE1 
run_test "tee stdout and inaccesible file" $TEMP_FILE1 < file1.txt

# cleanup

rm -f $TEMP_FILE1 $TEMP_FILE2 
Added link to previous question.
Source Link
pacmaninbw
  • 24.8k
  • 11
  • 46
  • 109

This is a follow up question to another attempt to implement the tee command.

This is a follow up question to another attempt to implement the tee command.

Simplify title and add tag
Source Link
Toby Speight
  • 81.7k
  • 14
  • 101
  • 308
Loading
added 2 characters in body
Source Link
Reinderien
  • 65.4k
  • 5
  • 69
  • 187
Loading
deleted 127 characters in body
Source Link
Reinderien
  • 65.4k
  • 5
  • 69
  • 187
Loading
Source Link
Mike
  • 309
  • 1
  • 5
Loading