Sponsored Content
Full Discussion: Quick Favour needed
Top Forums Shell Programming and Scripting Quick Favour needed Post 302338215 by aLderzz on Monday 27th of July 2009 09:49:29 AM
Old 07-27-2009
Quick Favour needed

Hi there, i currently dont have access to my linux machine and need to get these script files sent to someone. Can someone please create .sh files for me with the code that i have displayed below. It would be very very helpfull.

There are 3 different scripts and it would be great if someone could put them in .sh files and send them to me. Thanks in advance! xx

Code:
#Delete script
#
dustbin=/home/08012109/unix/dustbin
  # making a varible for the dustbin so I don't repeatedly have to type out the full path
  if [ -d $dustbin ]; then
  echo "Dustbin found"
  else
  echo "Creating  Dustbin"
  mkdir $dustbin
  fi
  #
  # if dustbin doesn't exist mkdir dustbin.
   
  if [ -f $1 ]; then
  echo "file found"
  echo "$1 moved to dustbin"
  else
  echo "file not found"
  echo "can't move $1 to dustbin"
  fi
  #
  # Validating file exists
  mv $1 $dustbin
  #
  # 'deleting' file by simply moving it to dustbin.
   
   
  exit 0
   
  # end of script



Code:
# restore script
#
  case "$1" in
  -n)
  echo where do want the file to be moved to?
  read loc
  echo moving file $2 to $loc....
  mv dustbin/$2 $loc
  ;;
  *)
  echo moving file $1 to 08012109/linux...
  mv dustbin/$1 /home/08012109/linux
  ;;
  esac

Code:
# Trash script
#
#
if [ -d dustbin ]; then
echo "dustbin found"
else
echo "there's no dustbin to empty"
exit 0
fi
#
#if dustbin doesn't exist throw error 'there's no dustbin to empty'

case "$1" in

-a)
if (test -z "$(ls dustbin)" );
  then
 echo "bin already empty"
  else
rm dustbin/*
echo dustbin emptied
fi
#
#bin emptied
;;
-i)
echo "-i chosen"
;;
-ai)

if (test -z "$(ls dustbin)" );
  then
 echo "bin already empty"
  else
rm -irv dustbin/*
fi

;;
*)
echo "chosen nothing"
;;
esac
#
# use a case statement for each of the options and also one for the combination of options. -i and regular versions not working correctly

 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

i need quick help???...please

hey guys i'm new in this world " unix " i wanna any websites can help me to learn unix or any websites i can download UNIX from it thanks :D (3 Replies)
Discussion started by: M_Hafez
3 Replies

2. IP Networking

IP Address changes - Quick Help Needed.

We are running Solaris 9 and I have changed the IP address, Subnet Mask & Broadcast Address using ifconfig and have also changed the default gateway. How do I save these changes as I have bounced the box and it reverted back to the old IP Address settings. I am really new to UNIX and we... (4 Replies)
Discussion started by: gingerd2003
4 Replies

3. Shell Programming and Scripting

Quick one

Hallo friends, I have a log file called xxx.log which is generated everymorning. I want to change this file to xxx_.log Please assist, i am using ksh on AIX. Ta, Pax (4 Replies)
Discussion started by: kekanap
4 Replies

4. Shell Programming and Scripting

Quick help needed in the Shell Script

Hiii, i have a doubt here-- I have to take backup of all the files inside directory dir(logs,tmp,corefiles) at the location $BackupLocation.i should take the backup of logs,tmp,corefiles inside the $BackupLocation directory and then remove the files and touch the files inside the directory... (1 Reply)
Discussion started by: namishtiwari
1 Replies

5. UNIX for Advanced & Expert Users

Guidance needed for quick script

Hi all, I am trying to get the exception count daily from a log file which is more than 1 GB in size. I am using loops which get the count of the exception and transaction. But i need to take this exception count for a time frame from 5.00 am to 5:00 pm. I Think I can use to exact the... (4 Replies)
Discussion started by: senthilkumar_ak
4 Replies

6. Solaris

Quick help!

Hi, iam trying to use lofiadm in solaris 5.10 but getting the following error.. bash-3.00# lofiadm -a /asmdisks/_file_disk1 lofiadm: /dev/lofictl: No such file or directory i dont see lofictl file in /dev .. i checked in other similar machines..i found this file..can i export this file from... (2 Replies)
Discussion started by: rags_s11
2 Replies

7. Shell Programming and Scripting

Notepad help needed easy quick question

TAKE A LOOK AT THE ATTACHED PICTURE. my goal is just to SELECT n DELETE Those lines : Dialogue: Marked=0,0:02:39.49,0:02:40.49,Default,NTP,0000,00 00,0000,!Effect, (without the text) take a look at that picture... the marked line... i just need ALL of these lines removed.. i managed... (3 Replies)
Discussion started by: mr_spidey
3 Replies

8. Shell Programming and Scripting

Quick help on 'awk' needed...!!

bash-2.05$ A=`cat /etc/group |awk -F':' '{if ($1$3$4 ==... (3 Replies)
Discussion started by: ak835
3 Replies
echo(3XCURSES)						  X/Open Curses Library Functions					    echo(3XCURSES)

NAME
echo, noecho - enable/disable terminal echo SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib -R /usr/xpg4/lib -lcurses [ library... ] c89 [ flag... ] file... -lcurses [ library... ] #include <curses.h> int echo(void); int noecho(void); DESCRIPTION
The echo() function enables Echo mode for the current screen. The noecho() function disables Echo mode for the current screen. Initially, curses software echo mode is enabled and hardware echo mode of the tty driver is disabled. The echo() and noecho() functions control soft- ware echo only. Hardware echo must remain disabled for the duration of the application, else the behavior is undefined. RETURN VALUES
Upon successful completion, these functions return OK. Otherwise, they return ERR. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
getch(3XCURSES), getstr(3XCURSES), initscr(3XCURSES), libcurses(3XCURSES), scanw(3XCURSES), attributes(5), standards(5) SunOS 5.11 5 Jun 2002 echo(3XCURSES)
All times are GMT -4. The time now is 09:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy