no need to launch sub shell. Use a code block will do as well.
{ time ls; } 2> out.txt
or
{ time ls > /dev/null 2>&1 ; } 2> out.txt
More Related Contents:
- Find and replace in file and overwrite file doesn’t work, it empties the file
- how to get the time after two minutes [closed]
- How to select lines between two marker patterns which may occur multiple times with awk/sed
- How to use multiple arguments for awk with a shebang (i.e. #!)?
- How to read a file into a variable in shell?
- What are the uses of the exec command in shell scripts? [closed]
- How can I reverse the order of lines in a file?
- How to make grep only match if the entire line matches?
- How can I execute a command stored in a variable?
- What is /dev/null 2>&1?
- How/When does Execute Shell mark a build as failure in Jenkins?
- Compare two files line by line and generate the difference in another file
- Alternative to `sed -i` on Solaris
- Floating-point arithmetic in UNIX shell script
- Run java jar file on a server as background process
- How do you tell if a string contains another string in POSIX sh?
- How does the #! shebang work?
- Concise and portable “join” on the Unix command-line
- Unix find command, what are the {} and \; for?
- Compare a string using sh shell
- What does the line “#!/bin/sh” mean in a UNIX shell script?
- Trim leading and trailing spaces from a string in awk
- Can I call a function of a shell script from another shell script?
- What’s the difference between ${varname} and $varname in a shell scripts
- Read file into String and do a loop in Expect Script
- How do I determine if a web page exists with shell scripting?
- How to add text at the end of each line in unix
- Call a Unix Script from Excel Vba
- How to print 5 consecutive lines after a pattern in file using awk [duplicate]
- Unix shell script find out which directory the script file resides?