Search : in
By :

How do I Write this shell script

Last answer on Oct 13, 2009 7:50:58 am BST seaman77, on Feb 16, 2009 7:05:19 am GMT 
 Report this message to moderators

Hello, please write this shell script
1- Write a shell script (trans.sh) that :
- Take as command-line options any number of text files
-Read in each of these files, converts all the letters to uppercase, and then stores the results in a file of the same name but with a .caps extension

2- Write a script (execadd.sh) that will take a single filename as an argument and adds execute permission to the file for the user, but only if the file is a regular file.
Your script must check to see that there is exactly one argument. If there are no arguments or more than one arguments, your script must produce a "usage" message that tells how to use the script. You write it this way:
echo "Usage: $0 filename"
You must check to see if the file exists; if it doesn't, give an error message. You must check to see if the file is a regular file; if not, give an appropriate message

Configuration: Crawler/Search Engine Indeterminable

Best answers for « How do I Write this shell script » in :
How to read a file line by line ShowHow to read a file line by line Intro Tips Bonus Intro One of the most common errors of learning scripts bash on GNU / Linux is to read a file line by line, is to use a loop "for" (for line in $ (cat file.txt) do. ..), which in this...
Replacing Variables in Bash/shell ShowReplacing Variables in Bash/shell Intro: Expression:Defininition Intro: First of all make sure that you the variable is defined before replacing it, or in other cases determine that it is not empty, and to initialize with a default...
Renaming multiple files in batch ShowRenaming multiple files in batch Native features Using a third-party program Renaming a large number of files can quickly become tedious. Fortunately, there are tools to automate this task in many cases: Native features On Windows...
Download Vista Live Shell Pack - Pink ShowIf you want to have Vista on your computer but your shape is not rather powerful or if simply you cannot have to be paid this version yet? Then resolution is to change the appearance of your good old XP. Vista Live Shell Pack is a topic of office...
Download SSH Secure Shell ShowSSH secure shell for workstations is a flexible client SSH allowing to connect in a secured way to remote applications. http://www.commentcamarche.net/faq/images/NHc6wz5jOYBhPXTis.png
Linux - The shell ShowIntroduction to the shell The command interpreter is the interface between the user and the operating system, hence the name "shell". The shell therefore acts as an intermediary between the operating system and the user thanks to command lines...
UNIX system - The shell ShowIntroduction to the shell The command interpreter is the interface between the user and the operating system, hence its name "shell". The shell therefore acts as an intermediary between the operating system and the user using command lines...
UNIX - Files ShowIntroduction to UNIX files In UNIX systems any element is represented in the form of a file. All files are architectured around a single tree structure where the base, called the root, is written "/". File types UNIX systems define different...

1

jipicy, on Feb 16, 2009 6:19:09 pm GMT
  • +1

Hi,

How do I Write this shell script?
Whith your fingers and your head !
$ man woman
Il n'y a pas de page de manuel pour woman.

Reply to jipicy

2

writer, on Mar 20, 2009 4:21:31 pm GMT
  • +6

Seams like he has some university homewroks to do :))

Reply to writer

3

 seaman77, on Mar 20, 2009 7:30:53 pm GMT
  • +1

This is my trying , there are problems in this script please help me to fix the proplems
#!/bin/bash

if [$# -eq 0]
then
echo ""
echo "error: you didn't entered a file nameafter script"
echo ""
exit 1
fi

if [$# -gt 1]
then
echo "error: you entered 2 files name or more"

echo "right syntax: ./execadd.sh file-name"
exit1
fi

if [$# -eq 1] && ls | grep= $1
then
sudo chmod 755 $1

echo "you have permission now on $1"
else
echo "file doesn't exict in this directory"
exit0
fi

Reply to seaman77