top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are steps that a UNIX shell follows while processing a command?

+1 vote
486 views
What are steps that a UNIX shell follows while processing a command?
posted Feb 27, 2016 by Mohammed Hussain

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

The sequence of executing commands by shell are as follows:

Parsing: The command is broke into words, by using the spaces as delimiters unless quoted. The tabs are replaced by a single space.

Evaluation of a variable: The words with $ as preceding character will be evaluted unless quoted.

Command Substitution: The commands surrounded by backquotes will be executed by the shell. Later these will be replaced into standard output of the command into command line.

Wild card interpretation: Finally, the shell identifies all the wild cards(?,*) in the command line and replaces the wild card with sorted list of file names which maches the pattern.

PATH evaluation: Ultimately shell looks for the PATH variable for the purpose of determining the sequence of directories to search for the files or commands.

answer Feb 27, 2016 by Shivaranjini
Similar Questions
+2 votes

I am using below script to validate IPV6 address but this script also pass invalid IP such as empty string, name etc.

if [[ "$IPv6ADDR"=~"^:?([a-fA-F0-9]{1,4}(:|.)?){0,8}(:|::)?([a-fA-F0-9]{1,4}(:|.)?){0,8}$" ]]; then
  echo "valid ipv6 addr"
  break;
else
  echo "Invalid IP Address"
  break;
fi

Can someone identify what's wrong in the regex, Please?

+1 vote

The command to convert from .xlsx to csv works in putty, but the same when given in informatica fails....I am getting exit error code 32512.

The workflowlog >>

Severity    Timestamp   Node    Thread  Message Code    Message
INFO    9/8/2016 5:28:20 PM Node_BIDEV  140284941813504 LM_36621    Command task instance [Convert_csv]: started command [convert], with pid [14121] on node [Node_BIDEV].
ERROR   9/8/2016 5:28:21 PM Node_BIDEV  140285390595840 LM_36623    Command task instance [Convert_csv]: execution of command [convert] did not complete successfully with exit code [32512]
WARNING 9/8/2016 5:28:21 PM Node_BIDEV  140285390595840 LM_36626    Command task instance [Convert_csv]: previous command [convert] failed and "run if previous command succeeded" option is set, the remaining commands will not be run.
ERROR   9/8/2016 5:28:21 PM Node_BIDEV  140285390595840 LM_36320    Command task instance [Convert_csv]: Execution failed.
WARNING 9/8/2016 5:28:21 PM Node_BIDEV  140285390595840 LM_36373    Workflow [wf_CUSTOMER_SURVEY_CORE_DailyFiles] is suspended.
INFO    9/8/2016 5:28:22 PM Node_BIDEV  140285390595840 LM_36375    Workflow [wf_CUSTOMER_SURVEY_CORE_DailyFiles]: Sent suspension email to email user 
WARNING 9/8/2016 5:28:27 PM Node_BIDEV  140284973283072 LM_36371    Workflow [wf_CUSTOMER_SURVEY_CORE_DailyFiles] is aborting.
WARNING 9/8/2016 5:28:27 PM Node_BIDEV  140284973283072 LM_36322    Workflow [wf_CUSTOMER_SURVEY_CORE_DailyFiles]: Execution aborted.

The command script I am using is

libreoffice --headless --convert-to csv:"Text - txt - csv (StarCalc)":"126,0,76,1,2" /var/opt/load/Sourcedata/CUSTOMER_SURVEY/2016Q2_ML_V1.xlsx

Please help me...

+1 vote

Is it possible to run a command and capture its output via an FD (like in proc_open()), but without using the shell? As far as I can see now there is no way to do it. I think that's a simple feature, maybe just add it to proc_open()? (for example run command directly using exec() if the first argument is an array?) it would be rational because there is already such option for Windows...

...