Bash Echo Write Error Invalid Argument
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack echo write to 1 failed invalid argument Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack
Cat Write Error Invalid Argument
Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up bash - echo: fatal write error invalid argument write error: invalid argument up vote 2 down vote favorite I am new to bash and trying to write a script that disables kworker business as in aMaia's answer here. So far, I have this, which I run from root: 1 #!/bin/bash
Git Write Error Invalid Argument
2 3 cd /sys/firmware/acpi/interrupts 4 for i in gpe[[:digit:]]* # Don't mess with gpe_all 5 do 6 num=`awk '{print $1}' $i` 7 if (( $num >= 1000 )); then # potential CPU hogs? 8 # Back it up and then disable it!! 9 cp $i /root/${i}.backup 10 echo "disable" > $i 11 fi 12 done But running it results in: ./kkiller: line 10: echo: write error: Invalid argument What is going on here? I thought $i was just the file name, which seems like the correct echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device bash: echo: write error: invalid argument syntax for echo. Suggestions for cleaning up/improving the script in general are also appreciated! Update: With set -vx added to the top of the script, here is a problematic iteration: + for i in 'gpe[[:digit:]]*' awk '{print $1}' $i ++ awk '{print $1}' gpe66 + num=1024908 + (( 1024908 >= 1000 )) + cp gpe66 /root/gpe66.backup + echo disable ./kkiller: line 10: echo: write error: Invalid argument bash shell scripting echo sh share|improve this question edited Jan 1 '15 at 21:37 asked Jan 1 '15 at 21:19 nicole 1,15722249 you need to see what value is being stored in $i, add set -vx after the first line of your script. You'll get the shell debug/trace output. I think you'll see that $i will be value like gpe99, which won't work in your test (( $num > = 1000 )). I'm not sure about echo "disable" > $i, so include more debugging output in your question so we can help you. (Cmd executed, and error msg as they occur in your output). Good luck. –shellter Jan 1 '15 at 21:29 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote accepted I think it has something to with permissions. I don't think root has write access to those files by default. Try echoing manually 'disable' to that file, even as root you get the same error shown. So to make your script work, first do chmod 744 on $i before your echo, it should do the trick. share|improve this answer answered
Tutorials/Articles Search HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Linux Forums > Linux - Software echo and cat : write error: Invalid argument User Name Remember Me? Password Linux - Software This forum is for Software issues. Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing http://stackoverflow.com/questions/27734792/bash-echo-write-error-invalid-argument LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today! Note that registered members see fewer ads, and ContentLink is completely disabled once you log in. Are http://www.linuxquestions.org/questions/linux-software-2/echo-and-cat-write-error-invalid-argument-945600/ you new to LinuxQuestions.org? Visit the following links: Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here. Having a problem logging in? Please visit this page to clear all LQ-related cookies. Introduction to Linux - A Hands on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own. Click Here to receive
Support Search GitHub This https://github.com/scality/RestBlockDriver/issues/34 repository Watch 34 Star 16 Fork 6 scality/RestBlockDriver https://ubuntuforums.org/showthread.php?t=2011666 Code Issues 50 Pull requests 2 Projects 0 Pulse Graphs New issue echo: write error: Invalid argument /sys/class/dewb/add_mirrors #34 Closed tmnkey opened this Issue Aug 7, 2014 · 1 comment Projects None yet invalid argument Labels None yet Milestone No milestone Assignees olivdelp 2 participants tmnkey commented Aug 7, 2014 To write into /sys/class/dewb/add_mirrors, we need to call "echo" command twice to make it successful. As is below: ....... root@app05:/nfs/test/packages/RestBlockDriver# sudo -s root@app05:/nfs/test/packages/RestBlockDriver# echo "http://192.168.0.5/test" > /sys/class/dewb/add_mirrors write error invalid bash: echo: write error: Invalid argument root@app05:/nfs/test/packages/RestBlockDriver# echo "http://192.168.0.5/test" > /sys/class/dewb/add_mirrors root@app05:/nfs/test/packages/RestBlockDriver# cat /sys/class/dewb/mirrors http://192.168.0.5/test we can cat /sys/class/dewb/mirrors safely but before that, we need to echo twice. ######## the sequence of steps to reproduce the error. ######### root@app05:/nfs/test/packages/RestBlockDriver# rmmod dewblock root@app05:/nfs/test/packages/RestBlockDriver# ls dewb.c dewb.h dewblock.ko dewblock.o dewb.o fio_amazon_dewblock.sh modules.order test.sh dewb_cdmi.c dewb_http.c dewblock.mod.c dewblock_parted.sh dewb_sysfs.c jsmn Module.symvers udev dewb_cdmi.o dewb_http.o dewblock.mod.o dewblock.sh dewb_sysfs.o Makefile README.md root@app05:/nfs/test/packages/RestBlockDriver# insmod dewblock.ko root@app05:/nfs/test/packages/RestBlockDriver# lsmod | grep dewblock dewblock 136511423 0 root@app05:/nfs/test/packages/RestBlockDriver# sudo -s root@app05:/nfs/test/packages/RestBlockDriver# echo "http://192.168.0.5/test" > /sys/class/dewb/add_mirrors bash: echo: write error: Invalid argument root@app05:/nfs/test/packages/RestBlockDriver# echo "http://192.168.0.5/test" > /sys/class/dewb/add_mirrors root@app05:/nfs/test/packages/RestBlockDriver# cat /sys/class/dewb/mirrors http://192.168.0.5/test root@app05:/nfs/test/packages/RestBlockDriver# curl http://192.168.0.5 Index of / ../READMEsys/test/root@app05:/nfs/test/packages/RestBlockDriver# curl http://192.168.0.5/test root@app05:/nfs/test/packages/RestBlockDriver# for i in {1..16}; do echo "vol$i 8000000000" > /sys/class/dewb/create; done root@app05:/nfs/test/packages/RestBlockDriver# part
Get Kubuntu Get Xubuntu Get Lubuntu Get UbuntuStudio Get Mythbuntu Get Edubuntu Get Ubuntu-GNOME Get UbuntuKylin Ubuntu Code of Conduct Ubuntu Wiki Community Wiki Other Support Launchpad Answers Ubuntu IRC Support AskUbuntu Official Documentation User Documentation Social Media Facebook Twitter Useful Links Distrowatch Bugs: Ubuntu PPAs: Ubuntu Web Upd8: Ubuntu OMG! Ubuntu Ubuntu Insights Planet Ubuntu Activity Page Please read before SSO login Advanced Search Forum The Ubuntu Forum Community Ubuntu Official Flavours Support New to Ubuntu [ubuntu] cat write error invalid argument Having an Issue With Posting ? Do you want to help us debug the posting issues ? < is the place to report it, thanks ! Results 1 to 7 of 7 Thread: cat write error invalid argument Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode June 27th, 2012 #1 ihsankocak View Profile View Forum Posts Private Message 5 Cups of Ubuntu Join Date Dec 2010 Beans 29 cat write error invalid argument hi, i am trying to: abc@abc-linux:~/Desktop$ cat "sample.au" > /dev/snd/seq but it says:cat write error invalid argument do you see what the problem is? Adv Reply June 27th, 2012 #2 drmrgd View Profile View Forum Posts Private Message Tall Cafè Ubuntu Join Date Apr 2011 Location Maryland Beans 1,461 DistroKubuntu 12.04 Precise Pangolin Re: cat write error invalid argument Do you have write permissions for that file? Try running the command with sudo. Adv Reply June 27th, 2012 #3 ihsankocak View Profile View Forum Posts Private Message 5 Cups of Ubuntu Join Date Dec 2010 Beans 29 Re: cat write error invalid argument Originally Posted by drmrgd Do you have write permissions for that file? Try running the command with sudo. yes i tried it with sudo but same error occured. Adv Reply June 27th, 2012 #4 Miljet View Profile View Forum Posts Private Message Gran