You can have it nicely organized, or you can have it in one line.
I'd say what you have now is already nicely organized. I don't think there's any way to reorganize it in fewer lines without making it less legible.
(If the funtion2
weren't there, you could combine the two conditions.)
If you insist on putting that entire chunk of code on line line, you can do it simply by joining the lines and adding semicolons, like this:
funtion1 ; if [[ $valueX == 2 ]]; then funtion2 ; if [[ $valueY -gt 16 ]]; then sleep $valueZ ; fi ; fi
But as I said, I don't think anyone would call this "nicely organized"; it's more difficult to read, and to maintain, than the original multi-line nicely indented version.
Note that the [[
syntax is specific to bash; ash doesn't support it.
(Oh, and you've misspelled "function".)