Find the answer to your Linux question:
Results 1 to 4 of 4
People reading the forums, lend me yer ears! I would like to get, in example; this Bash command: Code: #!/bin/bash mplayer jkl.flv And make Perl do the same thing! Is ...
  1. #1
    Just Joined! heyyeh's Avatar
    Join Date
    Aug 2008
    Posts
    71

    [SOLVED] Perl Acting Like Bash

    People reading the forums, lend me yer ears!

    I would like to get, in example; this Bash command:
    Code:
    #!/bin/bash
    mplayer jkl.flv



    And make Perl do the same thing! Is there a way to put Bash commands inside Perl?

    If so, thus I ask this question once more!

  2. #2
    Linux User
    Join Date
    Jul 2007
    Location
    Greece
    Posts
    277
    I don't think you can use bash commands in perl. Correct me if I'm wrong.

  3. #3
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
    Posts
    1,117
    Hi.

    Making a few assumptions, you are likely looking for system:
    Code:
    perldoc -f system
    the perldoc program being a very useful tool for perl use:
    Code:
    perldoc perldoc
    One assumption I made is that you are referring to an external command as defined by:
    Commands on Unix-like operating systems are either built-ins or external commands. The former are part of the shell. The latter consist of both executables, which are programs that have been written in a programming language (e.g., C, C++, Java or Python) and then compiled into a binary, and shell scripts.

    -- What is a command? -- definition by The Linux Information Project (LINFO)
    For example:
    Code:
    #!/bin/csh
    mplayer jkl.flv
    Would not make mplayer a csh command, but an external command because it is not a csh built-in.

    Best wishes ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  4. #4
    Just Joined! heyyeh's Avatar
    Join Date
    Aug 2008
    Posts
    71
    I've already found the answer.
    system '/usr/bin/mplayer jkl.flv' will do the trick.
    My Perl script is done and I can use it now!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...