Sponsored Content
Top Forums Shell Programming and Scripting Problems with find | ls within a for statement Post 302458883 by bartus11 on Saturday 2nd of October 2010 11:07:13 AM
Old 10-02-2010
Code:
for dir in "`find /root/test -type d`" ;do
    echo "$dir"
done

for dir in "`ls -1d /root/test/*/`" ;do
    echo "$dir"
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

if statement problems...need some help.

Hey all. I have written a script to clear all of the context records from our scanning guns. The problem is, whenever I run the script, it just freezes and does nothing. I'm not getting any errors so I'm not exactly sure what I'm doing wrong. Here is the script... #!/bin/ksh... (1 Reply)
Discussion started by: jalge2
1 Replies

2. Shell Programming and Scripting

find/if statement not working

Hi guys: I am trying to delete multiple files in a folder with different names. Below is the script that I was trying, but it doesn't work ************************** #!/bin/ksh DATE=`date '+20%y%m%d'` DEL_DIR=<dir where files have to be deleted> let DATE2=$(($DATE - 2)) let DATE1=$(($DATE... (12 Replies)
Discussion started by: geomonap
12 Replies

3. UNIX for Dummies Questions & Answers

Find statement

for FNAME in `find /unixs/apps/sqr/ -type f -exec grep -il unixs {} \;`; do C=`grep -c unixs ${FNAME}`; echo "${C}:${FNAME}" >> /unixs/apps/cibcur01.txt; done I have this statement but I only want to look for my string in file types .sql, .KSH,.sh files. How can I accomplish this? (2 Replies)
Discussion started by: TimHortons
2 Replies

4. Shell Programming and Scripting

whats wrong with this find statement ?

cmd="find /a/technologies -name '*.jar' | grep \"Tuning/specificloader/lib\"" echo $cmd for index in `$cmd` do SL_JARS="${SL_JARS}:${index}" done gives error ==> find: paths must precede expression Usage: find but for index in... (2 Replies)
Discussion started by: crackthehit007
2 Replies

5. UNIX for Dummies Questions & Answers

echo statement when find returns null

Hi, How do you echo something once when a find statement returns null results? This is when using mutiple locations and mutiple arguments. The below find command the inner loop of a nested for loop where the outter loop holds the $args and the inner loop holds the locations. find... (2 Replies)
Discussion started by: tchoruma
2 Replies

6. Shell Programming and Scripting

trying to find match from multiple string if statement

I'm trying to create what (should be) a simple bash script that will pull computer name and use that info to bind to one of three servers. Is there any way to do this without having a text file with the names of the servers and associated computer names? (5 Replies)
Discussion started by: jacobsbigbro1
5 Replies

7. UNIX for Dummies Questions & Answers

Statement to find if an entry exists in a file

I need to check if an entry input by the user is in a file. If so, I need to run a command, and if it does not exist then it should output entry does not exist. So I have so far... echo "Enter record:" read record //command || //command Can I use an if statement to do this? (3 Replies)
Discussion started by: itech4814
3 Replies

8. UNIX for Dummies Questions & Answers

Multiple Find Conditions in IF Statement - UNIX

When I try the below if Condition with single condition its working fine. But when I try to Club both its working . But giving wrong results. In my case cond1 = -f ${filename1} = true cond2 = -f ${filename2} = true But Cond1 & Cond2 is resulting in False ??? Please advise ... (5 Replies)
Discussion started by: Shiny_Reddy
5 Replies

9. Shell Programming and Scripting

Problems with an if statement

Hey guys/gals, I am feeling extremely rusty today and having a problem with a monitoring script I am writing. I am trying to write a monitor using a entry in a line in log file. I can get the entry extracted from the file to a temp file. But when I try and do the if statement for the greater... (3 Replies)
Discussion started by: scottzx7rr
3 Replies

10. Shell Programming and Scripting

Problems with if statement

Hi guys..i'm totally new to linux shell scripting and i have written a simple script that allows to poll a directory and when there is at least one file, it is moved to another directory. But i have an error in the if statement " Syntax error: "then" unexpected (expecting "done")" #!/bin/bash... (2 Replies)
Discussion started by: GrifoneSeduto
2 Replies
set_color(1)							       fish							      set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 06:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy