1

I need to run a command ls and cal in single line

But i need to write it without using & and ; symbols...

Is there any way to write it?

Vi Vek
  • 147
  • 1
  • 2
  • 8
  • 4
    Why? This sounds like homework, or is it just a random puzzle you came up with? Obviously your ampersand and semicolon keys haven't been stolen since you could write them in the question text ... – unwind Aug 16 '13 at 12:04
  • 1
    What exactly is the context of the problem? Why do you want to do this this way? – Paul Evans Aug 16 '13 at 12:07
  • No i was playing a small web challenges. And i got struck in this point ... they blocked both symbols in it and there might be any way to solve it seems... just to know weather we have any alternatives to it... – Vi Vek Aug 16 '13 at 12:08
  • 1
    Not particularly useful, but `! cal || ls` comes to mind... – twalberg Sep 10 '13 at 20:26

2 Answers2

2

You could use backticks and echo

echo `ls` "`cal`"

The double quotes keep echo from destroying the whitespace in cals output.

chinchin
  • 271
  • 5
  • 16
  • __passthru("grep -i $our_value contents.txt");__ we need pass our input in our value place and need to execute multiple commands – Vi Vek Aug 16 '13 at 12:31
  • 1
    What is "passthru"? And please ask the question you want answered, to begin with. – chinchin Aug 16 '13 at 12:48
0

I guess | will help you. To read the listing of a directory with many files, page-by-page, I did ls | more

Yaro
  • 570
  • 3
  • 20
  • __preg_match('/[;|&]/',Sinput)__ Is there any other way without | symbol... Still it not works – Vi Vek Aug 16 '13 at 12:12
  • @ViVek , Try looking [here](http://stackoverflow.com/questions/13077241/execute-combine-multiple-linux-commands-in-one-line) – Yaro Aug 16 '13 at 12:18