Sunday, July 7, 2019

bash - The function definitions in shell use dash

The following code:



#!/bin/bash


function me-test()
{
echo 'test'
}

me-test


The execution method below is not correct:




#sh 1.sh
1.sh: line 6: `me-test': not a valid identifier


but the execution method below is correct:



#./1.sh
test



In other programming languages,it can not using dash to define function.For example,python.



why shell is so that?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...