05-24-2009
Hi
Instead of writing -- ls -l | cut -c59-78 this might not give you the correct file name.
write : ls -l | awk '{print $NF}' to pull the file name.
-if you will provide a "directory name" as argument - It will by default look into your current directory as subdirectory only. and can't intelligently cd to the directory you are expecting.
-You can provide full path name in the argument so that the cd will work properly if it is directory else if it will be a file you can search on it.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello there,
As a newbie:
The directories in PATH can be hard to distinguish when printed out as
one line with colon .Please, can i have a sample script to display
them,one to a line.
Thank you. (1 Reply)
Discussion started by: debut
1 Replies
2. Shell Programming and Scripting
Hi everyone.
I need to write a script which will download files/folders (a huge collection) to the local file server (centOS 4.4 Server),
and check regularly (every 6 hours or so if any new files are present, or if the old ones were modified to update contents).
Any insights on how to tackle... (2 Replies)
Discussion started by: reminiscent
2 Replies
3. Shell Programming and Scripting
Hi,
root@server] df -h
121G 14G 101G 12% /home
147G 126G 14G 91% /backup
We having our site files and images are storing in
/backup/home/user/files/ through symbolic link created in /home directory pointing in /backup directory as following.
root@server] cd /home... (1 Reply)
Discussion started by: mirfan
1 Replies
4. Shell Programming and Scripting
Hello
I have a directory structure with year in format 4 digits, e.g 2009, below which is month format 1 or 2 digits, e.g 1 or 12, blow which is day format 1 or 2 digits, e.g 1 or 31.
I want to change the names of lots of directories to the be
Year - 4 digits , e.g 2009 - No change here... (4 Replies)
Discussion started by: garethsays
4 Replies
5. Shell Programming and Scripting
I need some help recovering from a "slight" screwup. We just moved 3 TB of data from one RAID Array to another. Low lever archive files. This was done with a regular cp (for some reason) and now we have lost all the timestamps on the files, and we urgently need to get the timestamps back on these... (7 Replies)
Discussion started by: chj
7 Replies
6. Shell Programming and Scripting
How can I change the cron entries only for ABC and XYZ from dosomething_1.0.sh to nowchanged_2.0 using a bash script ?
Any help will be appreciated.
#
# ABC
00,05,10,15,20,25,30,35,40,45,50,55 * * * * /mydir/dosomething_1.0.sh 1>/dev/null 2>&1
#
#
##
# DEF... (4 Replies)
Discussion started by: jville
4 Replies
7. Shell Programming and Scripting
Hi,
I have a command in my bash script, searchDirectoryName.sh:
DIR_NAME=$(find . -type d)
echo "${DIR_NAME}"
.
./Dir1
./Dir1/1.0.2.1
./Dir2
./Dir2/1.1
./Dir3
./Dir3/2.2.1
How can I select only following directory names with second subdirectoies and without first ./ in the... (3 Replies)
Discussion started by: hce
3 Replies
8. Shell Programming and Scripting
Hello Guys
I have a script working fine on csh, but I would like to change it to bash, how I should change this command to be able to work as bash script. :wall:
if ( $fsw > "0" ) then
foreach swath ( `awk 'BEGIN {for (i='$fsw';i<='$lsw';i++) printf ("%s\n", i) }'` )
## work to be done... (2 Replies)
Discussion started by: jiam912
2 Replies
9. UNIX for Beginners Questions & Answers
#!/bin/bash
X=$(</home/cogiz/computerhand.txt) # (3S 8C 2H 6D QC 8S 4H 5H)
Y=$(</home/cogiz/topcardinplay.txt) # KS
A=( "${Y::1}" )
B=( "${Y:1}" )
for e in ${X}; do
if ]; then # searching for valid cards K,S or 8
... (0 Replies)
Discussion started by: cogiz
0 Replies
10. Shell Programming and Scripting
I am trying to change dates in a bash script.
I have a start time and an endtime and want to increment the times. Basically
the month and day have to be incremented in a loop to create two strings, stm and
etm defining the start and end times.
stm="2014-05-13T00:00:00"... (4 Replies)
Discussion started by: novilatte
4 Replies