UNIX commands question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX commands question
# 1  
Old 12-04-2014
UNIX commands question

Code:
if [[ "$(echo ${dest#build.} | cut -f2 -d.)" != "S55555" ]]
then
rm -rf

Can anyone tell me what are they checking in the if loop



Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by vbe; 12-04-2014 at 09:13 AM..
# 2  
Old 12-04-2014
It compares the value of the variable 'dest', of which the 2nd field been cuted off, and if it is NOT S55555, then remove something the has not been copied into the post.....

However, i dont know what ${dest#build.} does as substitution (or if it is valid).

Hope this helps
# 3  
Old 12-04-2014
The section ${dest#build.} will evaluate to the string value of $dest with any leading build. removed, so:-
Code:
$ dest=build.myfile
$ echo ${dest#build.}
myfile
$ dest=hello.myfile
$ echo ${dest#build.}
hello.myfile


I hope that this helps,
Robin
This User Gave Thanks to rbatte1 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX commands question

I am using HP-UXsystem. I am unable to use the below sed commands. could you please let us know the alternate commands for it. >sed '/unix/ c "Change line"' file.txt sed '/unix/ i "Add a new line"' file.txt any inputs please (5 Replies)
Discussion started by: ramkumar15
5 Replies

2. UNIX for Dummies Questions & Answers

Beginner UNIX question. tail and find commands

hey guys, i'm in a unix course.. and while this is a homework question - i did put alittle effort into it. just wanted to ask before trial and error drives me nuts. question 13 has us saving the last 30 characters of a file into another file and question 14 has us saving the list of all the... (1 Reply)
Discussion started by: labelthief
1 Replies

3. UNIX for Dummies Questions & Answers

Noob scripting question with android ADB commands

Hi I'm pretty new to scripting and I've been googling around looking for an answer but have yet to come up with a proper solution. I work with multiple android devices at a time and I'm looking to simplify my life with a script. Basically I'm looking for a script that takes the device ID's and then... (2 Replies)
Discussion started by: Onyoursix
2 Replies

4. Homework & Coursework Questions

Unix commands Help

I am struggling with one of my assignment questions, not sure how to go about coding it question is 2. The fille ~eliwp/marks is a colon separated list of students and their marks. Write a script to process this file printing out the id's of the students that have failed the module.... (2 Replies)
Discussion started by: tina_2010
2 Replies

5. Shell Programming and Scripting

question about shell commands...

Hello, I have the following is a txt file: !!! man.uni.com address 141.000.001 to you.uni.com !!! man.uni.com address 141.000.002 to wae1.uni.com !!! man.uni.com address 141.000.003 to kim2.uni.com I want to get you,wae and kim from the text and put them in a diffrent file in the following... (2 Replies)
Discussion started by: andrew1400
2 Replies

6. Shell Programming and Scripting

Question about awk commands

what does this mean? cat /etc/passwd | awk -F: '{print $5}' | \ awk -F, '{print $1}' | \ awk '{print tolower($l)};{print tolower($2)}' | \ grep -v '^$' >> local_tmp (1 Reply)
Discussion started by: hin-linux
1 Replies

7. Shell Programming and Scripting

ssh commands in ksh question

Is there a way to shorten these commands? because this script asks for a password 3 times scp -p /usr/local/bin/${script_name} ${servername$iy]}://usr/local/bin/ ssh ${servernames} /usr/local/bin/${script_name} ssh ${servernames} rm -f /usr/local/bin/${script_name} Basically, I'm creating a... (3 Replies)
Discussion started by: pdtak
3 Replies

8. UNIX for Dummies Questions & Answers

Running UNIX commands remotely in Windows box from Unix box – avoid entering password

I am able to run the UNIX commands in a Windows box from a UNIX box through "SSH" functionality. But whenever the SSH connection is established between UNIX and Windows, password for windows box is being asked. Is there a way to avoid asking password whenever the SSH connection is made? Can I... (1 Reply)
Discussion started by: D.kalpana
1 Replies

9. UNIX for Dummies Questions & Answers

Question about batched commands

Hi everyone I am a newbbie in the linux enviroment. My problem is: I have tried to use the at command to compile and keep running a program and close the terminal window. Every time I use the at command I get the next error "Can't open /var/run/atd.pid to signal atd. No atd running?" ... (2 Replies)
Discussion started by: fenixbeta
2 Replies

10. UNIX for Dummies Questions & Answers

Maingrame to UNIX sending UNIX commands

I want to know if there is a way to send unix commands thru FTP from a mainframe to kick off Autosys Jobs. I just need to send a command from the mainframe to UNIX and have UNIX execute that command. (2 Replies)
Discussion started by: skammer
2 Replies
Login or Register to Ask a Question