Sponsored Content
Top Forums UNIX for Dummies Questions & Answers BASH Shell Scripting: If, Then Statement Post 302796053 by inkjoy00 on Thursday 18th of April 2013 09:00:54 PM
Old 04-18-2013
Sorry. I didn't fully write the code. It should delete all "/* */" in the file_name.c

Code:
#!/bin/bash

read "cat file" // User will input command cat file_name.c
if [ '$file == $file.c ]; // Must be a .c file
then
  sed '/*/,/\//d' 
else
 exit // Any other file won't change
fi

How come you chose to use case instead? Wouldn't an if, then statement work better?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

bash shell scripting

Hi, i am new to UNIX. I have couple of basic questions. 1. Is the syntax for BASH shell programming same in the LINUX and SUN SOLARIS operating systems? 2. I have to work on BASH shell programming in SUN SOLARIS operating system. I am going through the documentation from the following... (4 Replies)
Discussion started by: azazalis
4 Replies

2. Shell Programming and Scripting

Help!! bash shell scripting..

Can any1 please help me... i'm really lost in using bash shell scripting... and i got to hand this up on monday... please anyone teach me how to do this assignment... Please use basic things because i just learn the program only... thanks ... (1 Reply)
Discussion started by: Fr0z3n999
1 Replies

3. Shell Programming and Scripting

Bash shell Scripting help

wwww wwwwwwww wwwwwwwwwwwww (0 Replies)
Discussion started by: keyvan
0 Replies

4. UNIX for Dummies Questions & Answers

korn shell to bash - statement not working

Everything else seems to be working, but this isn't. Is it the "cat..." that is wrong of the condition? Thanks. cat tc_result.txt | while read LINE do if then let "files_run += 1"; echo "inside the if loop" # save current filetype case $LINE... (5 Replies)
Discussion started by: brdholman
5 Replies

5. Shell Programming and Scripting

File handling with bash shell scripting

Hi all, Can anyone guide to get tricks for file handling in bash shell? Thanks in advance. Thanks Deepak (2 Replies)
Discussion started by: naw_deepak
2 Replies

6. Homework & Coursework Questions

Help with bash shell scripting

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a bash shell script that takes as an argument a name. Then your script will ask the user for two numbers.... (15 Replies)
Discussion started by: boyboy1212
15 Replies

7. Shell Programming and Scripting

Bash shell scripting doubt

Hello All, I am setting up a cron job, where i am calling a shell script to make few builds. I got struck at a point, need some expert inputs to proceed further. The script is categorized in 5 parts and in the last part while building software it asks for few questions like:- 1. Build mode... (4 Replies)
Discussion started by: sahil_jammu
4 Replies

8. UNIX for Dummies Questions & Answers

Learn bash shell scripting

I do not know shell scripting. But at work place, I have got an in and out shell scripting task. I just need to understand a very big script. Is there any tool in which I can place the script and it can tell me the meaning of the whole script? (3 Replies)
Discussion started by: lg123
3 Replies

9. Shell Programming and Scripting

Generate sql statement using shell scripting

Can anyone please assist me? I have attached 2 input files and one output file. I need to generate the sql update statements using the above 2 input files. if inputfile2 has 5 rows, then we should generate 5 update statements because column1 is unique. inputfile1 and inputfile2 may contain more... (10 Replies)
Discussion started by: vinus
10 Replies

10. Shell Programming and Scripting

Shell scripting with case statement

Foe example we have three environments int,qa and prod.Each environment has some number of servers. int=Server1,Server2,Server3 qa=Server4,Server5,Server6 prod=Server7,Server8,Server9 echo "Enter the Environment i.e int,qa,prod" read env case $env in int) ## Need command where all the... (9 Replies)
Discussion started by: nareshreddy443
9 Replies
realpath(3X)															      realpath(3X)

NAME
realpath - resolve pathname SYNOPSIS
DESCRIPTION
The function derives, from the pathname pointed to by file_name, an absolute pathname that names the same file, whose resolution does not involve or symbolic links. The generated pathname is stored, up to a maximum of bytes, in the buffer pointed to by resolved_name. RETURN VALUE
On successful completion, returns a pointer to the resolved name. Otherwise, returns a null pointer and sets errno to indicate the error, and the contents of the buffer pointed to by resolved_name are undefined. ERRORS
The function will fail if: Read or search permission was denied for a component of file_name. Either the file_name or resolved_name argument is a null pointer. An error occurred while reading from the file system. Too many symbolic links were encountered in resolving path. The file_name argument is longer than or a pathname component is longer than A component of file_name does not name an existing file or file_name points to an empty string. A component of the path prefix is not a directory. The function may fail if: Pathname resolution of a symbolic link produced an intermediate result whose length exceeds Insufficient storage space is available. SEE ALSO
sysconf(2), getcwd(3C), thread_safety(5), glossary(9), <stdlib.h>. CHANGE HISTORY
First released in Issue 4, Version 2. realpath(3X)
All times are GMT -4. The time now is 06:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy