• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 462
  • Last Modified:

exec hangs up

i am trying to execute exec 1 > somefile.log but it just hangs and when i issue ctrl+z and ctrl+c it is not working.Please explain what does exec 1 > somefile.log 2<$l  do? and also explain why does process wont kill when i ssue ctrl+z or ctrl+c comand when it hangs.
0
aixtutorial
Asked:
aixtutorial
1 Solution
 
woolmilkporcCommented:
Hi,
the exec command is used for redirection of file descriptors. File descriptor 1 is stdout (standard output stream).
exec 1> /some/file redirects all standard output to the specified file instead of the terminal.
Note - it's very important not to leave a space between "1" and ">", else the shell would try to execute "1" as a command.
Your problems might be related to that extra space. Is there an executable "1" somewhere in your path? Normally the shell would say " 1:  not found."
2<$I doesn't make sense at all. What is "$I"? A variable? I guess you wanted to write "&1". File descriptor 2 is stderr (the standard error output stream). "<" is used to redirect input. With 2<1 you redirect stdout to stderr, while you previously redirected stdout to a file.
I assume you actually want to redirect stderr to the same target as stdout (somefile.log in your case). The usual notation for this is 2>&1, but the version 2<&1 will work, too.
ctrl-c not working might be related to the extra space between ">" and "1". Omit that space and see what happens.
wmp
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now