几个Shell Script面试题
2023-07-06
1. How do you take a single line of input from the user in a shell script?
2. Write a script to convert all DOS style backslashes to UNIX style slashes in a list of files.
3. Write a regular expression (or sed script) to replace alloccurrences of the letter ‘f’, followed by any number of characters, followed by the letter ‘a’, followed by one or more numeric characters,followed by the letter ‘n’, and replace what’s found with the string“UNIX”.
4. What happens to a child process that dies and has no parent process to wait for it and what’s bad about this?
5. How do you create a swapfile?1. How do you take a single line of input from the user in a shell script?
2. Write a script to convert all DOS style backslashes to UNIX style slashes in a list of files.
3. Write a regular expression (or sed script) to replace all occurrences of the letter ‘f’, followed by any number of characters,followed by the letter ‘a’, followed by one or more numeric characters,followed by the letter ‘n’, and replace what’s found with the string “UNIX”.
4. What happens to a child process that dies and has no parent process to wait for it and what’s bad about this?
5. How do you create a swapfile?