I am new to shell programming and have an assignment question which requires me to list the contents of the present working directory in 4 column format and highlight any subdirectories.
Homework assignments are not permitted here, but maybe this will get you started:
Quote:
It then requires me to develop the shell script to accept a directory name as a positional parameter (if no parameter use the present working directory); then adapt is to accept more than one directory as positional parameters; and finally adapt it to display the name of the sub directory and ask whether to: descend and list the contents, list the contents without changing the present working directory, or ignore the directory. (it was suggested that a recursive call would be handy)
I am struggling to write a shell script which performs this task. I found the following script in a forum which i think was written for old version shell (SH). I have tried to reuse this shell and adapt it to the BASH shell.
With very few exceptions, scripts written for sh will run without modification in bash.
Quote:
If anyone is able to help me either adapt the below code or have any suggestions on how i can go about this question.
Hi.
I'm trying to write a script that will delete all directories found, that are not named as a "number" (year)...
here is what i mean, let's say i have within /data/exports the following directories:
/data/exports/2000
/data/exports/2001
/data/exports/2002
/data/exports/daily/2000... (5 Replies)
*Just realized that i posted this in the wrong forum. should have been in Shell, though it is on AIX...
Hi.
I'm trying to write a script that will delete all directories found, that are not named as a "number" (year)...
here is what i mean, let's say i have within /data/exports the... (8 Replies)
I am new to shell programming and have an assignment question which requires me to list the contents of the present working directory in 4 column format and highlight any subdirectories. It then requires me to develop the shell script to accept a directory name as a positional parameter (if no... (1 Reply)
Hi,
The user value y/n should get display in upper case
printf "$FBOLD\nDo you want to continue?: $FREG"
Do you want to continue?: y
Though user enters in smaller case y, but it should get display in uppercase Y
How it can be done ?
With Regards (2 Replies)
Hi All
after looking around the website and various other resources I become stuck. I'm trying to rename directories from
Firstname Initial Lastname to lastname,_firstname_initial
so far ive got
for f in {./}
do
rename -n 'y/A-Z/a-z/' *
rename -n 's/\ /_/g' * ... (2 Replies)
I have a shell script which I made with the help of this forum
#!/bin/sh
RuleNum=$1
cat bw_rules | sed 's/^.*-x //' | awk -v var=$RuleNum '$1==var {for(i=1;i<=NF;i++) {if($i=="-bwout") print $(i+3),$(i+1)}}'
Basically I have a pages after pages of bandwidth rules and the script gives... (0 Replies)
Hi,
I want a script shell to automate modifying httpd.conf file for
several instances of apache, save httpd.file before changing it, after
modifying it and then restart apache.
- Replace ServerRoot "xxxx" by ServerRoot "yyyy" of all directories :
"... (4 Replies)
0
Hi,
I am looking for a way of creating multiple directories using the mkdir -p command in a shell script.
I'm working with an Ubuntu machine and try to do something like that:
#!/bin/sh
... (3 Replies)
" Script for display sentences with special character"
Hi,
Could any one share a command how to display a line until my target word.
For ex: My file has the content as:
select * from db_wrk where col1 < col2
insert into table_name values('1','2','tst','wrk','dev','prod')
My target... (10 Replies)
Hi,
I need to display specific columns using select statement and spooled to a file and sending it as e-mail. But i am not seeing column header in my output even i use SET HEADING ON.//PREDEFINED LOGIN DETAILS
${ORACLE_HOME}/bin/sqlplus -s ${DB_LOGIN}/${DB_PASSWD} <<EOF
SET FEEDBACK OFF
SET... (1 Reply)