My first bash at shell scripting (sorry...)
Hello everybody, today I thought I'd have a go at some shell scripting. This was my first go at a simple script:
Code:
#!/bin/bash Alas no. I get "Binary operator expected" errors. I think I may be interpreting these guidelines wrong but $@ was what I thought I wanted. Clearly not. So my question is, what do I replace $1 with to make this script work with multiple files? (Assuming that's what I need to replace) PS. I know this is a silly script and rather dangerous at that, while I appreciate alternatives methods, I want the script to work because it's a script, not because I desire to shred multiple files, if you know what I mean. |
Use $* instead of $@ or do a loop like:
for arg do rm "$arg" done |
Quote:
Code:
#!/bin/bash |
Thank you very much. Nice speedy replies, (maybe record).
I'll probably see you later in my much anticipated thread "Help: I hosed my system with a silly script" Cheers. |
Since we're doing first bash scripts, here is mine (I was going to do "Hello world" script, but it was too simple so I did that one in my head).
It's pretty basic, it asks for a device, then a mountpoint, if you want to specify a filesystem type, and if you want to mount read only, then mounts it and asks if you want to mount another. I wrote it with the help of the Advanced Bash Scripting Guide I never use it, but I am keeping it because it was my first one. Code:
#! /bin/bash |
Nice script you got there, I too was thinking about ye olde "Hello World" but thought I'd rather do something semi-useful. My script was born out of a minor annoyance with the shred command. There is no option to recursively shred an entire directory tree.
EDIT: Woohoo 200! |
All times are GMT -5. The time now is 01:27 PM. |