Bash script if condition not executing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash script if condition not executing
# 8  
Old 03-28-2017
Moderator's Comments:
Mod Comment Removing the text describing the reason for posting a thread after suggestions have been provided to try to help you fix a thread makes the thread impossible to understand and serves to waste the time of everyone who tired to help you.

Repeatedly refusing to properly use CODE and ICODE tags makes your posts hard to read and wastes the time of the volunteers who have to edit your posts for you.

Having numerous violations in such a short period of time has resulted in this account being placed in read-only mode for a day.

When read only mode expires, please restore the text that you have deleted from several posts (#1, #3, #5, and #7) in this thread so people reading your thread will be able to understand what was going on.

Destroying the context of a thread like this in the future may result in this account being permanently banned.
These 2 Users Gave Thanks to Don Cragun For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Condition in bash script

I want get from user and pass these parameters to bash script. script should copy files in user home directory. FYI: each file might be exist or not, might be one of them exist or four of them. Here is my script, it always copy file1 and seems only one of them execute! #!/bin/bash for... (6 Replies)
Discussion started by: indeed_1
6 Replies

2. Shell Programming and Scripting

Executing sed command inside a bash script

I want to run commands inside a bash script. An example is I want to pass the command in a string as regexp as an argument to the script, then run sed on the bash variable sed.sh regexp sed.sh "-i \"s/<p>//g\"" then call sed "$regexp" $fl (3 Replies)
Discussion started by: Kangol
3 Replies

3. Shell Programming and Scripting

Creating a condition on a bash script

I wrote a code to find codons in a DNA string. The only problem I have is how do I make the code only work for a file with DNA. This means the file only has the characters a,c,g,t and no white space characters. (3 Replies)
Discussion started by: germany1517
3 Replies

4. Shell Programming and Scripting

Need Multiple checks inside if condition in a bash shell script

Hi, I need to perform the untar and rm operation if the file found is a .tar and does not have test.tar or hello.tar as the file names. Below is the loop to check the same. for tf in *.tar do if ] then found=1 ... (1 Reply)
Discussion started by: mohtashims
1 Replies

5. Shell Programming and Scripting

Executing multiple scripts using if condition

I have an if condition. If that condition is true then one script will be run and after that I need to check another condition based on the output value of first script. i tried like below : cd lock if ; then rm exitup if ; then kb_shutdown kb_startup if ; then rm exitup if ;... (3 Replies)
Discussion started by: charanarjun
3 Replies

6. UNIX for Dummies Questions & Answers

Write pid and command name to a txt file while executing a bash script

Hi All, Just have a requirement, I am executing a bash shell script, my requirement is to catch the pid and job name to a txt file in the same directory, is there anyway to do it? please help me out. Regards Rahul ---------- Post updated at 08:42 AM ---------- Previous update was at... (2 Replies)
Discussion started by: rahulkalra9
2 Replies

7. Shell Programming and Scripting

Bash script errors when executing

I'm working on a script that will search through a directory for MKV files and remux them to MP4. I found a few other scripts around the net that do this, but they all have limitations that don't always get the job done. The main limitation I've found is that most scripts look for the video track... (2 Replies)
Discussion started by: rayne127
2 Replies

8. Programming

if condition in bash

Hi, I have meaning to include an if condition statement in my code to check the directory for existing output files and if its existing i want the program to delete it before doing the succeeding command. i just dont know the correct syntax for it. thanks much guys, this forum has indeed been very... (4 Replies)
Discussion started by: ida1215
4 Replies

9. Shell Programming and Scripting

[bash] Executing script that is held in a variable

Hi, I'm building an installation system that uses separate data files that contain the individual characteristics of each package. Within the data file, I would like to incorporate a section that contains a bash script that is loaded into an array which is then redirected to bash to be... (13 Replies)
Discussion started by: ASGR
13 Replies

10. UNIX for Dummies Questions & Answers

Specified Ksh but executing in bash

Hi, I am a new bie to unix shell programming. I have specified ksh as the first line in my script but when executed it complains. *********** Script=test******************** #!/usr/bin/ksh echo hello print -p 123 ************************************ ++++++++ Execution... (7 Replies)
Discussion started by: akhilnagpal
7 Replies
Login or Register to Ask a Question