Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 4
    If one needs extra fanciness, the $(...) syntax is worth considering. There's an explanation somewhere else on ULSE that I can't find now. Commented Oct 24, 2016 at 13:50
  • 2
    I've modified your post to include quotes. If the OP wants to create paths or files and doesn't use quotes, he will get wrong results if there are spaces in the variable. Commented Oct 24, 2016 at 13:52
  • Thanks for the help. But according to your method, it seems that the result of last command is already known. What if the last command generates random strings on the screen and there is no way to know the strings in advance? Anyway, thanks for the reply. Commented Oct 24, 2016 at 13:55
  • @Bo-YuanNing Replace uname -n with the name of your random-string-generator command and you'll have what you want. Commented Oct 24, 2016 at 13:57