Search Results

Search: Posts Made By: Little
4,161
Posted By mjf
find . -type d Searches for directories...
find . -type d
Searches for directories recursively starting from current folder.

\( -name archive -o -name log \) -prune
If directory is named archive or log then remove (prune) it from...
4,161
Posted By MadeInGermany
find . -type d \( -name archive -o -name log \)...
find . -type d \( -name archive -o -name log \) -prune -o -type f -print
If this correctly prints the files to be deleted then replace -print by -delete or -exec rm -f {} +
1,426
Posted By RavinderSingh13
Hello little, Nice to see you again in...
Hello little,

Nice to see you again in forum. Could you please try following and let me know if this helps, I have made a similar directory structure in my /tmp and tried following command, you...
1,426
Posted By Don Cragun
If you don't mind having a trailing backslash...
If you don't mind having a trailing backslash printed with your directory names, the trivial way to do it is:
printf '%s\n' /a/b/c/home??/*/
If you do mind the trailing backslash, you can use a for...
30,093
Posted By Scrutinizer
See man ssh_config...
See man ssh_config (https://www.unix.com/man-page/all/5/ssh_config/)
IdentityFile
Specifies a file from which the user's DSA, ECDSA or DSA authentication identity is
read. [..]

...
1,232
Posted By sea
Hiya Try: for f in abc* do mv "$f"...
Hiya

Try:
for f in abc*
do mv "$f" "${f/abc/bck.abc}"
done
Or even simpler:
for f in abc*
do mv "$f" "bck.$f
done

hth
22,965
Posted By MadeInGermany
If you really want the shell to compute variable...
If you really want the shell to compute variable names:
eval result_$count=`$exe_command`
22,965
Posted By rbatte1
So, you are trying to set a variable variable...
So, you are trying to set a variable variable name then. Have you considered using an array?
#!/bin/ksh93
set -A result

count=0
while :
do
while read exe_command
do
...
22,965
Posted By radoulov
Have you tried it?
Have you tried it?
1,438
Posted By RudiC
Try this and adapt to your...
Try this and adapt to your needs:stamp_pos=filename.extn_DT
[ "${stamp_pos#*_DT}" ]; EC=$?; read DT$EC DT$((1-EC)) <<< "_2013/11/16 "
while IFS=. read FN EXT; do echo $FN$DT0.$EXT$DT1; done <file
1,438
Posted By Aia
At some point a toggle must be switched for...
At some point a toggle must be switched for prefix or suffix.

Let's use a command line argument:
e.i stamp_it 0

for f in *.txt; do
case ${1} in
0)
echo $(date "+%F").${f} ;;
...
1,337
Posted By Scott
It's perfect! I had added REST_OF_LINE to my post...
It's perfect! I had added REST_OF_LINE to my post after submitting it. That'll pick up everything after the last cron time field.
6,687
Posted By pravin27
Put your child process in background using & sign...
Put your child process in background using & sign at the end of the child process.
. /home/program/child.sh &
18,633
Posted By wisecracker
Longhand in OSX 10.7.5 default bash terminal:- ...
Longhand in OSX 10.7.5 default bash terminal:-
Last login: Mon Sep 16 15:43:08 on ttys000
AMIGA:barrywalker~> text="Files successfully removed..."
AMIGA:barrywalker~> lentext="${#text}"...
18,633
Posted By in2nix4life
Another way using pure Bash magic: ...
Another way using pure Bash magic:


out="files successfully moved"
dash="-"
echo -e "${out}\n${out//?/$dash}"
files successfully moved
-----------------------
18,633
Posted By rdrtx1
try also: echo "files successfully moved"| awk...
try also:
echo "files successfully moved"| awk '1; {gsub(".","-")}1'
18,633
Posted By Subbeh
This is way to do it using awk: awk -v i=10...
This is way to do it using awk:
awk -v i=10 'BEGIN { OFS="-"; $i="-"; print }'
i=10 specifies the amount of characters, you can change it to i=$no
18,633
Posted By balajesuri
i=1 while [ $i -le $no ] do echo -n "-" ...
i=1
while [ $i -le $no ]
do
echo -n "-"
(( i++ ))
done
echo


or
echo "files successfully moved" | sed 's/./-/g'
2,690
Posted By RavinderSingh13
Hello, Let me share an example with you...
Hello,

Let me share an example with you hope this will help you more.
Let's say I want to see all ksh files at "/home/user/bin/singh_testing/*.ksh
same you can put here .txt in place of ksh...
6,605
Posted By Scott
You've gone overkill on the backquotes. The...
You've gone overkill on the backquotes.

The $(...) method of command substitution is easier on the eyes, and replaces the 'obsolete' `...` method.

$ MOD_FILE_NAME="${FILE_NAME%.*}.$(date...
18,616
Posted By RavinderSingh13
Hello, Could you please the following if...
Hello,

Could you please the following if this helps.





$ cat script_user_error.ksh
echo "In shell_script_B.sh"
FILENAME="original.txt"
echo "FILENAME = {$FILENAME}"
echo ""
echo...
18,616
Posted By vidyadhar85
Pleas read my reply to your thread.. since you...
Pleas read my reply to your thread.. since you are piping the out put to while it will open a subshell and variable value would be lost once its back to main shell

use
while read line ; do
blah...
3,320
Posted By Just Ice
here is what i got after i added the missing " in...
here is what i got after i added the missing " in shell_script_A.sh ...
FILENAME="" # clearing the FILENAME
echo "FILENAME = {$FILENAME}"
[otto@centosgeek ~]$...
7,902
Posted By balajesuri
If $1 is empty, then ${1:-s1.txt} expands to...
If $1 is empty, then ${1:-s1.txt} expands to "s1.txt". It's like telling, if $1 is empty use the default value "s1.txt" instead.

$FILENAME is nothing but "s1.txt". So, both the approaches mean the...
19,097
Posted By vidyadhar85
try.. set FILENAME [lindex $argv 0]
try..


set FILENAME [lindex $argv 0]
Showing results 1 to 25 of 38

 
All times are GMT -4. The time now is 11:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy