Inline if shell script

后端 未结 5 1885
一向
一向 2021-02-02 06:12

Is it possible to execute shell script in command line like this :

counter=`ps -ef | grep -c \"myApplication\"`; if [ $counter -eq 1 ] then; echo \"true\";
>
         


        
5条回答
  •  不知归路
    2021-02-02 06:31

    I was struggling to combine both multiple lines feed into command and getting its results into a variable (not a file) and come up with this solution:

        FRA_PARAM="'db_recovery_file_dest'"
        FRA=$(
        sqlplus -S "/as sysdba" <

    Please note that single-quotes word was substituted, because otherwise I was receiving its autosubstitution to double quotes... ksh, HP-UX.

    Hopefully this will be helpful for somebody else too.

提交回复
热议问题