Inter-debugging of Perl shell scripts

Source: Internet
Author: User
Tags echo command

1 shell echo command will automatically add line breaks

2. $? Accept exit return values

3. The variable is equal to 'execute script', and the obtained value of the variable is the value output from the script to stdout.

Example:

1. Perl calls Shell

1. Contents in SH

#! /Usr/bin/sh
Echo 'date ';
Exit 1;

Content in test. pl

1 use strict;

2 Use warnings;
3 my $ S = 'sh 1. Sh ';
4 print stdout "$ s ";
5 my $ exitcode =$?> 8;
6 print "$ exitcode \ n ";

 

2 shell calls Perl

Shell script instance

#! /Usr/bin/sh
S = 'perl prepareenvironment. pl'
Echo $ ?;
Echo $ S;

 

3. The system command in Perl cannot execute system ("cd xxx ");

Ln-SF $ S/Good. DIC ../DIC/Good. DIC ln command when creating a soft connection, the first parameter must be an absolute path

Touch a.txt. When a.txt exists, touch only changes the time stamp of the file.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.