By this I meant: (for ex.)
How the command line is parsed. Or, in other words, how grep understand what is 1st argument and the 2nd one? Here it isn't considering IFS!
IFS is only used to split the results of unquoted expansions (such as $var, $(cmd)) and by the read command. The shell does not use it during its initial scan of the command line. During that early step, whitespace always delimits words (tokens, to be more precise), regardless of the value of IFS.
With regard to how grep finds its first argument, that's more involved. Once the shell has finished parsing the command line, it forks (or clones) itself. If all goes well, the new subshell calls one of the functions in the exec family with the command to run and a list of arguments to pass to it. This replaces the subshell with the command that was exec'd. The command's arguments are found in the array argv[], with the first argument at argv[1] (argv[0] is the command's name).
The details of creating the process and locating the list of arguments (and the environment) are overseen by the kernel and the c runtime.
Also, should you need to know every last detail of how your shell interprets command lines, you should read your shell's manual page in its entirety. There is also the POSIX standard's documentation, which will give you detailed knowledge of a common UNIX baseline:
I'm having some peculiar performance issues with my Gigabit Lan.
I have some 100Mb devices so I can't do the necessary "jumbo Frame" tweaks for absolute optimum performance as I'd prevent them access.
I'm getting appauling transfer rates sending files to the linux machine, around 10 Mbps 3%... (0 Replies)
Whenever I sftped a particular gzipped file to a particular directory and then try to unzip it, I get Permission Denied error.
With this file even I cannot do chmod. though the file permissions are -rw-r--r--
When same file I sftp to a different location I am able to gunzip it.
Directory... (0 Replies)
Hi all,
Ok os heres my situation. I have created a database style program that stores a persons info (name,address,phone number etc.) in a file ("database"). after i read in all the values above, i assign them to a line variable:
line="$name^$address^$phonenum" >> phonebuk
as you can see... (1 Reply)
Hi!
I am working in korn shell. I want to reset the dimiliter for the set command to "|" but instead of a command prompt return I am getting something as below
After issuing the command I am getting this....as if the shell is expecting something else. Can anybody suggest what's the problem.
... (2 Replies)
Scenario:
Step 1. I'm logging into AIX server using user id called user1
Step 2. I'm traversing to home directory of user2
Note: This user2's home directory has the permissions drwxr-s---
Step 3. I'm issuing command pwd there. I'm getting the expected output.
Step 4. I'm issuing the... (3 Replies)
hi I keep getting an error with this nested if statement and am getting the error unexpected end of file, can anyone help me as to why this wont execute?
#!/bin/bash
#script to check wether the -i -v statements run correctly
removeFile ()
{
mv $1 $HOME/deleted
}... (3 Replies)
I am using bash and resetting IFS as below when reading the command line arguments. I do this so I can call my script as in Ex1.
Ex1: ./synt2d-ray3dmod.bash --xsrc=12/20/30
This allows me to split both sides so that when I do "shift"
I can get 12/20/30
What I do not understand is... (21 Replies)
Hi ,
i am in my initial learning phase of unix. i was going thru the function part.
below is the example which was there but i am not able to understand logic and the use of IFS(internal field separator)
lspath() {
OLDIFS="$IFS"
IFS=:
for DIR in $PATH ; do echo $DIR ; done
IFS="$OLDIFS"... (8 Replies)