I would like convert a xml file to a html file. Where i can find a step by step tutorial (for linux) to do this in shell script, or which are the steps to follow. Sorry for the very basic question, but i am an absolute begginer on this. thanx Answer The basic tools to do this is XSLT. XSLT
Tag: shell
basename with spaces in a bash script?
I’m working on a bash script to create a new folder in /tmp/ using the name of a file, and then copy the file inside that folder. Behavior: When I type in mymove “/home/me/downloads/my new file.zip” it shows this: I have lots of quotes around everything, so I don’t understand why this …
Bash/sh ‘if else’ statement
I want to understand the if else statement in sh scripting. So I wrote the below to find out whether JAVA_HOME is set in the environment or not. I wrote the below script This my output to env: But I get the below output: Answer You’re running into a stupid limitation of the way sh expands arguments. Lin…
linux shell title case
I am wrinting a shell script and have a variable like this: something-that-is-hyphenated. I need to use it in various points in the script as: something-that-is-hyphenated, somethingthatishyphenated, SomethingThatIsHyphenated I have managed to change it to somethingthatishyphenated by stripping out – us…
finding unique values in a data file
I can do this in python but I was wondering if I could do this in Linux I have a file like this I want to find all the different types of values in the 3rd column by a particular username lets say name 1. grep name1 filename gives me all the lines, but there must be some way to
Changing working directories in Linux shell in a C program
My goal is to write a C program that is like a basic shell for Linux. I have everything working except changing working directories. I have tried the system() for input strings for cd and nothing happened. I also tried chdir(“tokened string”) and also no luck. Anyone have any ideas? This is part o…
Echo to both stdout and stderr
I have a probably pretty easy beginner question: How do I echo from a shell script into both stdout and stderr? I know that I can echo to stderr echo “foo” 1>&2 but I need the output in both. I tried some Googling but nothing worked. Answer This should do it
Why does xargs -L yield the right format, while xargs -n doesn’t?
Consider the following: Why does the -n option yield an incorrect formatting? Just in case, I’m using bash under Ubuntu. Thanks. Answer -L splits by lines; echo doesn’t separate its output by lines but by spaces, so a single ls -l is run and that formats all the columns as a group. -n splits by pa…
bash scripting: how to find the absolute path of “symlink/..”?
Given two files: Upon calling parent/scripts/hello.sh from any location, I would like (in the script) to find the full path of the parent directory. In this case parent. The main issue is that parent/scripts/.. refers to generic in unix. On the other hand, everything involving regexes is not generic and may b…
How to run process in terminal with reading only permission for given directory
I am trying to run a process in my terminal but I don’t trust the application that much. Is there is a way to run that application with just read permission from selected directory? I am using macOS. Answer As knittl told, you can use chroot for making jail. For the more complex things, MAC have MAC, (m…