General :: Write A Shell Script Which Will Read The Directory Path As Input From User?

Nov 28, 2010

I am new to writing shell scripts. So, please bare with me. I am currently trying to write a shell script which will read the directory path as input from user and will traverse the Dir tree to find all available audio and video files. I have tried to write as much as I could but I don't know where I am making mistake as I get some files to be audio file which are actully tar balls. On the second note there are some files which video but script shows them to be audio. And, some video files are completely skipped. I am giving the shell script below so that you can see. I am using two external files as source which I am attaching.

Code:

#!/bin/bash
#Let's load the extensions that we want to search for
vdExt=$(cat vdExtList)
adExt=$(cat adExtList)

[code]....

View 5 Replies


ADVERTISEMENT

General :: Write A Shell Script Which Will Simultaneously Collect OS User Information And Write In An Individual Text Files?

Feb 17, 2010

I want to write a shell script which will simultaneously collect OS user information and write in an individual text files.Can anyone tell me the syntax of the script.N.B. The user name will be mentioned in an array within the shell script.

View 8 Replies View Related

General :: Write Shell Script That Takes A File Path As Command-line Arguments?

Dec 14, 2010

How can i write a shell script that takes a file path as command-line arguments.and it should report whether the path denotes a file or a directory.

View 2 Replies View Related

General :: Write A Shell Script That Allows Only User 1 And User 2 To Execute A Program?

Feb 25, 2010

I've looked everywhere but I can't find where to change the default box for incoming mail, or am I on the wrong track. It's a nuisance having to change folders and I can't configure wastebin to empty on exit.And I can't get kmail to import from evolution. Do I have to go to the evolution storage and do it manually, and if so, how do I do that?

View 1 Replies View Related

General :: Shell Script - Use Variable In A For Loop With Directory Path?

Jan 19, 2011

I modified files in several directories, and need to run a diff on the backup I created before modifying the file.

I'm trying to compose a simple shell script to speed up the task, but getting a syntax error.

Here is what I have:

for i in DIR1 DIR2 DIR3 DIR4 DIR5 do;
diff /maindir/subdir/subdir/$i/filename.txt.old /maindir/subdir/subdir/$i/filename.txt;
done

I know the paths are valid, and if I run just the diff command with the actual DIR1 instead of $i it works.

View 2 Replies View Related

General :: Shell Script Is Defined In Someother Directory - How It Is Being Invoked With Path

May 30, 2011

extract.ksh use this scripts topic_file_publish.sh but extract.ksh resides in /data/apps/pnbos/scripts

but topic_file_publish.sh in below directory/data/apps/pnbgstk/publication >

ls topic_file_publish.sh topic_file_publish.sh fraespappp8:/data/apps > type topic_file_publish.sh topic_file_publish.sh is hashed (/data/apps/pnbgstk/publication/topic_file_publish.sh)

How it is done?

since topic_file_publish.sh is being directly referenced in the code with absolute path.

View 2 Replies View Related

General :: User Defined Input In Shell Script

Dec 2, 2010

I want ssh a remote server through shell script with predefines username and passwd. i dont know how to use expect command to do that.

View 4 Replies View Related

General :: Chmod To Allow Read And Write Permissions For Directory?

Mar 31, 2010

I have created directories in root. I am looking for the chmod command to allow all users read and write permissions to a specific directory. I have done chmod 775 for a file but I need this for a directory. This includes permissions on all files and sub directories.

View 3 Replies View Related

General :: Bourne Shell Input From File Using - Then Return Control To User?

May 5, 2011

I have a program that I run from the terminal that requires manual input (it's matlab in mex debugging mode, matlab -Dgdb, which starts the GNU C debugger with its own custom settings).

Every time I run this program I always type in the same few commands in the program's interactive shell before I actually start working (for example: run -nojvm; stop at mexFunction; continue). I want to avoid typing these commands and I thought I could do this with shell scripting, saving the commands in the mycommands file, then running: myprogram < mycommands

The problem is that this runs all the commands and then exits the program. I want it to run the commands and return control to me so I can run my commands. Is there a way to tell the shell to use a file or a string as the input to a program then immediately return control to the user without the exiting the program?

View 3 Replies View Related

General :: Allow Specific User Permission To Read / Write Folder?

Feb 4, 2011

allow specific user permission to read/write my folder

I have a folder called /TAR/Sketch

I added a new user, named Snoopy, I want to grant this user the ability to add files & directories to this folder which is under the group Sketches and the owner is me.

How can I accomplish this ?

View 1 Replies View Related

General :: Best Way To Allow A User To Write To The /var/www Directory?

Mar 3, 2010

On my laptop for testing, I simply chown each subdir of /var/www to my myuser:www-data. But, now that I am setting up a public facing server, I'm wondering if this is the proper way to do so? If not, what is the best way to allow a non-root account to write to /var/www.

View 4 Replies View Related

General :: Write Shell Script That Give A Number Between 1-3444 From User

Feb 18, 2011

i want to write shell script that give a number between 1-3444 from user and if user enter out of range number give error e.g number must between

read -p "plz Enter Number " p
while [ $p != [1-9] -o $p != [1-9][0-9] -o $p != [1-3][0-4][0-4][0-4] ]
do
read -p "plz Enter Valid Number" p
done

but this have an error in while statement ! two many argument

View 3 Replies View Related

Programming :: Write A Program Which Will Read Input From A Text File

Apr 7, 2010

i am trying to write a program which will read input from a text file, check if each line contains any alphabets and then display a message imforming me if there is an alphabet in each line. My text file is formatted in this way...

[Code]....

View 2 Replies View Related

Ubuntu :: Bash Script, Take User Input Then Use It As A Path?

Jan 29, 2011

I'm trying to make a script to make it quicker to encode videos.

Code:
#!/bin/bash
echo "Type the path of the video file"

[code]....

View 9 Replies View Related

General :: Permissions - Manually Mount A File System Read/write As A Normal User?

Oct 6, 2010

I want to simply mount an ext4 file-system onto a normal mount point in Ubuntu (/media/whereever), as read-writable for the current logged-in user, i.e. me.

I don't want to add anything into /etc/fstab, I just want to do it now, manually. I need super-user privileges to mount a device, but then only root can read-write that mount. I've tried various of the mount options, added it into fstab, but with no luck.

View 3 Replies View Related

General :: Giving User Write Access To Directory And Subdirectories

Aug 10, 2010

I need to give a user write access to /var/www and its subdirectories. The current directory permissions are as follows:rwx r-x r-x root root

I added the user to the root group but that didn't seem to help.I read I could chmod -R to change the access to write for the www directory and subdirectories but I don't want to change things and mess up the website. How can I give the user access to write to the www directory and subdirectories without messing anything up? Would changing the www directory group owner to his group cause an issue anywhere?

View 3 Replies View Related

General :: Root User Using Freshclam Command Cannot Write To Directory?

Jun 27, 2010

When I log on a root and attempt to issue the command Freshclam to upgrade the virus definitions it attempts or create a new file with a definition name. I get a message stating that the directory isnt writable. The user and group access rights are as follows:

USER = read, write, execute
Group = read, write, execute
All= read, execute.

The only way I can get around this is by applying a 777 which would be read, write and execute for all. Now, I have a group define with several user ids in it including Root.How do I connect the group with the directory/file so I dont have to apply a 777 access right to group users could issue the Freshclam command.

View 1 Replies View Related

General :: Setting Read Permissions Of A Directory For Root User Only?

Mar 21, 2010

I'm using ubuntu 9.10. I used the command:

root@aduait-laptop:~# sudo chown -R root:root /media/104B-FF96/Private to set the permissions of Private folder for root but it is giving error:

Code:
root@aduait-laptop:~# sudo chown -R root:root /media/104B-FF96/Private
chown: changing ownership of `/media/104B-FF96/Private/5.jpg': Operation not permitted
chown: changing ownership of `/media/104B-FF96/Private/6.jpg': Operation not permitted
chown: changing ownership of `/media/104B-FF96/Private/7.jpg': Operation not permitted

[Code].....

View 5 Replies View Related

General :: Open A Second Shell Session That Will Remember The User, Machine, And Directory

Sep 21, 2010

I'm ssh'ed into a machine and logged in as a different user. Is it possible to open a few new windows that will still be ssh'ed into that same machine, still logged in as that user?

View 2 Replies View Related

General :: Write A Script To Report Useful Information On Disk Utilization For Each User's Home Directory

Feb 27, 2010

I need to write a script to report useful information on disk utilization for each user's home directory.For each directory I need to show: 1. the long listing of that directory entry (but not the files in the directory), so that I can see the rights and owners of the directory.2. The amount of disk used by that directory, in human-readable format, including subdirectories. I need to have two lines for each user one after the other. For example:

/home/user1 directory info
/home/user1 disk usage
/home/user2 directory info
/home/user2 disk usage

The script will assume that all users, except user root, have their home directories in the /home directory (no need to do anything with the /etc/passwd file). And if the administrator adds or removes users, the script should still work correctly (so the script shows the information for all current users).

Here's what I do know. The command "ls -ld /home/user's_name" will give me the info I need for #1. And the command "du -hs" will give me the info I need for #2. What I don't know is how to grab each individual directory in order to apply the above commands to each of them in order. ???

View 14 Replies View Related

Software :: Read Multiple Lines From User Input In C?

Feb 26, 2010

in c how to read multiple lines from user input

using scanf it is not possible and using gets we can able to read one line at a time
hoe to read multiple lines at a time from user input....

View 1 Replies View Related

Ubuntu :: Broken Path To User Shell - Can't Complete Login

Jun 9, 2011

I inadvertently typed the wrong path when changing my user login shell and now every time I log in I get a message stating that it can't find the shell and boots me off the system. It will then redisplay the login prompt. I'm running Ubuntu Server x64 in VMware Workstation.

View 1 Replies View Related

Software :: Using An Shell Script - How To Change A Value In A File According To The User Input

Sep 28, 2009

I have a file called a.sql which I need to execute in a database and the script I am calling in a shell script .Before executing the script I have to change a value in the script according to the user input.How can I do this .

Eg...
A.sql file contains an sql query like this:

And My shll script is like this:

When executed the script it asks for enter salary and if the user has input 5000 then the Enter_salary value in a.sql must be replaced by 5000.

View 6 Replies View Related

Programming :: Take A Single Line Of Input From User In Shell Script?

Mar 10, 2011

How do i take a single line of input from the user in a shell script?

View 3 Replies View Related

Programming :: Bash - Read User Input: URLs Without The Enter Key Stroke?

Sep 23, 2010

Here's a challenge I've been struggling for months with:

I have a bash script that reads URL addresses of our internal server and then executes some test commands on them. Something like this:

Code:
read -p "Enter URL: " url
sh execute-what-ever-to $url

After copy-pasting the URL the user taps the enter key and the script proceeds, but here comes the tricky part: I want this to work without the need to press the enter key after copy-pasting the URL.

"read -n" does not work in this case, as the URLs vary greatly in length. However, the URLs always end to the same string. They could be like "http://url1/END", "http://url2/END" and so on. So this ending string "END" could be theoretically used to recognize that the whole URL has been pasted.

View 2 Replies View Related

Ubuntu :: Trying To Write Script To Perform Tasks Number Of Times Depending On User Input?

Apr 13, 2011

I'm trying to write a bash script with a for loop that will perform two tasks a number of times depending on the number the user enters at the start. Here is what I got so far. It works fine the first time but then it just exits with no error msgs. The problem is in the way I have written the loop command. I have searched the web for examples to find out what I'm doing wrong with no luck.

#!/bin/bash
declare -i Num=1
declare -i Strnum=8

[code]....

View 3 Replies View Related

Ubuntu :: Simulate A Floppy Drive With User Read Write

Sep 17, 2010

I have a computer with no floppy drive (x64 ubuntu lucid installed) I have a program (wine windows xp) that will only save data and export data from/to a floppy drive. I found information on setting up an emulated floppy drive. i.e.

sudo dd bs=512 count=2880 if=/dev/zero of=imagefile.img
sudo mkfs.msdos imagefile.img
sudo mount imagefile.img /media/floppy -o loop

I modified the winecfg to include under the drive section A: /media/floppy. Problem is I cannot write to the drive as a normal user. I have tried everything I know but only root can read write to the drive. Is there someway to set up this emulated floppy to allow me as a user to write and read contents.

View 1 Replies View Related

Programming :: Create A Simple Program With Will Continually Read Input From The User Until They Enter A Blank Line?

Apr 6, 2011

basically i have to create a simple program with will continually read input from the user until they enter a blank linei know how to read in certain input but not sure how to get it continually in a loop

View 2 Replies View Related

Networking :: Run The Job Under A Root Account And Deny Read/write Access To A Normal User?

Jan 18, 2010

I'm setting up Ubuntu Karmic on my sister's old computer for my nephew, he's quite young so my sister asked to install some content filtering. I'll first setup an OpenDNS account and I've installed and managed to get dansguardian and squid working on a virtual machine to try it out. so far it's working pretty well, but I need to secure it form the inside out.

I was thinking of blocking specific outbound ports so he could not bypass the proxy. because by default the firefox configuration can be easily changed. so I have a couple of questions.

1. is it possible to block outgoing ports on Ubuntu?
2. is that the best method?
3. is there anything else I should be aware of to prevent subversion?

lastly, this question is probably unrelated to this board but I've set up a cron job to update a dynamic ip with OpenDNS, the problem is that the password is in clear text in the user's crontab, can I play with permissions? is it possible to run the job under a root account and deny read/write access to a normal user?

View 1 Replies View Related

Software :: Create User With Password And Read / Write Privileges For Program Database

Oct 11, 2010

Unless your distro has taken care of it Centos 5.5, you'll need to create a user with a password and read/write privileges for program database. You can do this using the MySQL command line client if you are familiar with it. Well I am not familiar with it, so I wam wondering how to do it. As well when I run

mysql - p program </usr/share/program/mysql.sql>

It asks for a password. how do i find out this password.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved